Upload
insync2011
View
1.310
Download
3
Embed Size (px)
DESCRIPTION
Citation preview
The most comprehensive Oracle applications & technology content under one roof The most comprehensive Oracle applications & technology content under one roof
Oracle11g Top 10 features Not your usual Top 10.
Shan Nawaz Verisign Inc
The most comprehensive Oracle applications & technology content under one roof
WHO AM I • Shan Nawaz
– More than 13 years of experience in Database Technologies(Oracle, DB2, SQL Server)
• Database Engineer at Verisign – Tune mission criJcal applicaJons with millisecond SLA’s
• Industry CerJficaJons – OCP in Oracle7.3/8/9i/10g/11g – IBM CerJfied User specialist in DB2 – MCP in SQL Server 2000
• Recent/Future Technical Sessions – Oracle Open World 2011 – Hotsos 2011 – IOUG 2011 – Oracle Open World 2010 – Verisign Technical Symposium 2009
The most comprehensive Oracle applications & technology content under one roof
Agenda
• About Verisign and Our SLA’s • Not your usual Top 10 features • QA • References
The most comprehensive Oracle applications & technology content under one roof
Our SLA’s
• TransacJons made of complex SQL statements
Command SLA
CHECK DOMAIN 25ms
ADD DOMAIN 50ms
DELETE DOMAIN 100ms
MODIFY DOMAIN 100ms
The most comprehensive Oracle applications & technology content under one roof
Goal/MoJvaJon of this PresentaJon
• To visit Australia
• To talk about the very good features of Oracle11g that are overlooked by the very best features of Oracle 11g
The most comprehensive Oracle applications & technology content under one roof
Very Best Features 1. Database Replay 2. AdapGve Cursor Sharing 3. Flashback Data Archive/Total Recall 4. EdiGon Based redefiniGon 5. Deferred segment creaGon 6. Password Enhancements 7. SQL Plan Management 8. Result Cache 9. Virtual Indexes/Columns 10. Interval/System ParGGoning 11. Extended OpGmizer StaGsGcs 12. Online Patching 13. Recursive With clause 14. PL/SQL NaGve CompilaGon 15. Secure Files
The most comprehensive Oracle applications & technology content under one roof
Poor man’s parallelism
The most comprehensive Oracle applications & technology content under one roof
Poor man’s parallelism DBMS_PARALLEL_EXECUTE
• Supports parallel update of large data sets in smaller chunks.
• Chunks are created by segregaJng the data based on 1. Rowid 2. Numeric column 3. User-‐defined SQL.
The most comprehensive Oracle applications & technology content under one roof
Poor man’s parallelism
• Why is DBMS_PARALLEL_EXECUTE important ? – Unlike other parallel features , DBMS_PARALLEL_EXECUTE does not require Enterprise EdiJon.
– Eliminates much of manual coding and does befer job of distribuJng load uniformly across parallel processes
– Overcome restricJons of parallel DML
The most comprehensive Oracle applications & technology content under one roof
Poor man’s parallelism • Why is DBMS_PARALLEL_EXECUTE important ? (ConJnued) – Break large single transacJon into mulJple chunks (transacJons) • Less impact to dependent systems like Golden Gate or streams
• Less undo space required minimizing the chance of ORA-‐1555
• DuraJon of lock is reduced. – Restart failed chunks (transacJons) since Chunks are commifed individually (Implicit) • Impact of Rollback due to error is not severe.
The most comprehensive Oracle applications & technology content under one roof
Poor man’s parallelism DBMS_PARALLEL_EXECUTE
• How to implement? 1. Create a task with CREATE_TASK procedure 2. Create chunks (size) using one of the following.
– CREATE_CHUNKS_BY_ROWID – CREATE_CHUNKS_BY_NUMBER_COL – CREATE_CHUNKS_BY_SQL
3. Define the DML statement 4. Execute the task in parallel with RUN_TASK 5. Perform error handling and run failed chunks with
RESUME_TASK.
The most comprehensive Oracle applications & technology content under one roof
Poor man’s parallelism
Create a task with CREATE_TASK BEGIN DBMS_PARALLEL_EXECUTE.CREATE_TASK (TASK_NAME => 'UPDATE_TASK'); END;
Create chunks with ROWID. BEGIN DBMS_PARALLEL_EXECUTE.CREATE_CHUNKS_BY_ROWID(TASK_NAME => 'UPDATE_TASK‘, TABLE_OWNER
=> 'SCOTT‘, TABLE_NAME => 'CONTENT‘, BY_ROW=> FALSE, CHUNK_SIZE => 3075); END;
Define the Update statement and running the task DECLARE L_SQL_STMT VARCHAR2(32767); BEGIN L_SQL_STMT := 'UPDATE /*+ ROWID (DDA) */ CONTENT SET EXPIRATION_DATE= SYSDATE+14 WHERE ROWID BETWEEN :START_ID AND :END_ID'; DBMS_PARALLEL_EXECUTE.RUN_TASK(TASK_NAME => 'UPDATE_TASK‘,SQL_STMT=> L_SQL_STMT,LANGUAGE_FLAG
=> DBMS_SQL.NATIVE,PARALLEL_LEVEL=> 4); END;
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge DBMS_COMPARISON
• IdenJfy differences between data sets across databases or same database.
• Report and Synchronize the data set – Either the source or target can act as master.
• Intended mainly for replicated/streams environment but can be used outside of streams environment
• Works with 10g and above version provided one the databases in the comparison is 11g;
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge
• Comparison Modes Supported 1. Full Object comparison
• CMP_SCAN_MODE_FULL 2. Random data comparison
• CMP_SCAN_MODE_RANDOM 3. Cyclic Comparison
• CMP_SCAN_MODE_CYCLIC 4. Customized comparison
• CMP_SCAN_MODE_CUSTOM
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge
• Objects currently supported are – Tables – Single Table Views – Materialize Views – Synonyms for above objects
• Unique Indexes are used for comparison – Non-‐Unique indexes are used if specified manually
• Permits comparing row-‐row OR group of rows – Befer performance with group of rows
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge
• Steps 1. Create comparison object 2. Perform the comparison 3. Analyze the results 4. Converge the data
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge SQL> SELECT COUNT(*) FROM
CONTENT_1; COUNT(*) -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ 10
SQL> SELECT COUNT(*) FROM CONTENT_2;
COUNT(*) -‐-‐-‐-‐-‐-‐-‐-‐-‐-‐ 10 SQL> DELETE FROM CONTENT_2 2 WHERE ITEM_ID=484380; 1 row deleted. SQL> COMMIT;
The most comprehensive Oracle applications & technology content under one roof
Compare and Converge
Create Comparison Object SQL> BEGIN 2 DBMS_COMPARISON.CREATE_COMPARISON( 3 COMPARISON_NAME=>'MYCOMPARE', 4 SCHEMA_NAME=>'SCOTT', 5 OBJECT_NAME=>'CONTENT_1', 6 DBLINK_NAME=>NULL, 7 REMOTE_SCHEMA_NAME=>'SCOTT', 8 REMOTE_OBJECT_NAME=>'CONTENT_2'); 9 END; 10 / PL/SQL procedure successfully completed.
SQL> DECLARE 2 COMPARE_VALUE
DBMS_COMPARISON.COMPARISON_TYPE; 3 COMPARE_OUTPUT BOOLEAN; 4 BEGIN 5 COMPARE_OUTPUT := 6 DBMS_COMPARISON.COMPARE ( 7 COMPARISON_NAME=>'MYCOMPARE', 8 SCAN_INFO=>COMPARE_VALUE, 9 PERFORM_ROW_DIF=>TRUE); 10 IF COMPARE_OUTPUT=TRUE 11 THEN 12 DBMS_OUTPUT.PUT_LINE('Tables are IdenGcal'); 13 ELSE 14 DBMS_OUTPUT.PUT_LINE('Tables are not IdenGcal’); 15 END IF; 16* END; 17 / Tables are not IdenJcal, Differences Exist PL/SQL procedure successfully completed.
The most comprehensive Oracle applications & technology content under one roof
Reproducing SQL Test Case
The most comprehensive Oracle applications & technology content under one roof
Reproducing SQL Test Cases
• Remember the Jmes you were unable to resolve SQL issue
• Because – You are unable to reproduce the issue at will in producJon environment.
– Or Unable to reproduce the issue easily in Dev/QA environments. (Recurring issue)
– Or Oracle support was unable to help you because they don’t have the necessary informaJon to reproduce the issue
The most comprehensive Oracle applications & technology content under one roof
Reproducing SQL Test Cases • Help is on the way • Oracle 11g provides a tool called SQL Test case builder or SQL TCB. – As per Oracle documentaJon, If you ever need to contact Oracle Support about a SQL issue, then obtaining a reproducible test case is the single most important factor to ensure a speedy resoluJon.
• Provides as means of good shared language for exchanging informaJon with Oracle Support or DBA’s or developers. – Easy to diagnose , analyze and esJmate the fix.
• Back ported to 10.2.0.4
The most comprehensive Oracle applications & technology content under one roof
Reproducing SQL Test Cases
• Test case can be generated using 1. SQL text 2. SQL cursor 3. SQL from incident file
• SQL TCB can be also be directly with ADRCI command – DDE EXECUTE ACTION INCIDENT <incident_id> ACTIONNAME SQLTCB INVOCATION <invocaJon_id>
The most comprehensive Oracle applications & technology content under one roof
Reproducing SQL Test Cases • What kind of data is collected?
Permanent InformaGon • Always captured • InformaJon like SQL_TEXT,
disk reads, buffer gets, CPU Jme, elapsed Jme, fetches, ExecuJon plan , OpJmizer staJsJcs, Bind variables, rows processed Use of Outlines, SQL profiles or SPM and metadata and user profile.
• Data collecJon is opJonal • No Support for DDL
Transient InformaGon • Captured if Oracle thinks it is
necessary • InformaJon that could
necessarily change like dynamic sampling, degree of parallelism
The most comprehensive Oracle applications & technology content under one roof
Reproducing SQL Test Cases
• How to implement STB? 1. Create a directory or use exisJng directory 2. Export the test case with
DBMS_SQLDIAG.EXPORT_SQL_TESTCASE 3. Import the test case with
DBMS_SQLDIAG.IMPORT_SQL_TESTCASE
The most comprehensive Oracle applications & technology content under one roof
Reproduce SQL Test Cases
• Example
SQL> DECLARE 2 MYTESTCASE CLOB; 3 BEGIN 4 DBMS_SQLDIAG.EXPORT_SQL_TESTCASE ( 5 DIRECTORY=>'DATADIR', 6 SQL_TEXT=>'SELECT DOMAINNAME FROM DOMAIN
WHERE DOMAINNAME=2703255', 7 EXPORTDATA=> FALSE, 8 TESTCASE_NAME=>'MYTEST', 9 TESTCASE=>MYTESTCASE); 10 END; 11 /
The most comprehensive Oracle applications & technology content under one roof
SQL Test Case Builder
• Dump directory files created by SQL TCB.
The most comprehensive Oracle applications & technology content under one roof
Advanced Compression
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
• With huge amounts of data being the norm than excepJon , compression becomes criJcal in reducing the foot print of almost every component
Database
Network
Backup Server
Buffer Cache
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
In 11g, there is compression for everyone • Storage – OLTP compression for DML (Structured Data) – SecureFiles Compression (Unstructured Data)
• Network – Data Guard redo Compression
• Backup – RMAN compression – Data pump compression
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION OLTP Compression
• New compression algorithm uses deferred
or batched approach – Data is inserted as is without compression unJl PCTFREE value is reached.
– Compression of data starts once PCTFREE threshold is reached • Can be enabled at table, parJJon or tablespace level • No need of decompressing the data while reading • Recommended for low update acJvity tables • Use Compression advisor(DBMS_COMPRESSION) to
esJmate savings
DATA
PCTFREE
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION Data guard Compression
• Redo is compressed as it is transmifed over a network.
• Helps efficiently uJlize network bandwidth when data guard is across data centers
• Faster resynchronizaJon of Data guard during gap resoluJon.
• Recommended for low network bandwidth
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
Data guard Compression
• How to implement? – Specify “COMPRESSION” with iniJalizaJon parameter LOG_ARCHIVE_DEST_n
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
RMAN Compression
• Supports compression of backups using ZLIB algorithm – Faster compression and low CPU uJlizaJon compared to default BZIP2 (10g)
– Low compression raJo compared to BZIP2
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
RMAN Compression • How to Implement ? – Configured with CONFIGURE COMPRESSION ALGORITHM ‘value’ • With Advanced compression , value can be HIGH, MEDIUM(ZLIP) and LOW(LZO) • Without advanced compression , Only basic can be specified
– Execute backups with ‘AS COMPRESSED BACKUPSET’
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
Data Pump Compression
• Compression of metadata introduced in 10g • Compression of data introduced in 11g. • Inline operaJon – Save on storage allocaJon – No need to uncompress before Import
The most comprehensive Oracle applications & technology content under one roof
ADVANCED COMPRESSION
Data Pump Compression
• How to implement? – Enabled with expdp COMPRESSION afribute
• ALL • DATA_ONLY • METADATA_ONLY
The most comprehensive Oracle applications & technology content under one roof
Diagnosing and resolving failures
The most comprehensive Oracle applications & technology content under one roof
Diagnosing and Resolving Failures • Database Recovery advisor (DRA) – Diagnosing media Failures – Present repair opJons (with script) – Repair failures (if requested)
• Doesn’t mafer if you are a newbie DBA or highly experienced DBA – When in doubt , use DRA.
• Now you can blame Oracle if the something goes wrong. – And keep your Job, write a blog ……
The most comprehensive Oracle applications & technology content under one roof
Diagnosing and Resolving Failures
• The three RMAN commands to support DRA 1. LIST FAILURE
• Errors are classified as Low, High, CriJcal • Historical support for closed errors.
2. ADVISE FAILURE • Specifies the repair strategy • Supports both manual and automated repair opJons
3. REPAIR FAILURE • Supports preview mode (spooling the script)
The most comprehensive Oracle applications & technology content under one roof
MulGsecGon Backups
The most comprehensive Oracle applications & technology content under one roof
MulJsecJon Backups
• Enables backing up of single datafile in parallel using secJons – SecJon is conJguous range of blocks in a datafile
• Up to 256 SecJons or channels per datafile is supported
• MulJplexed backups will not contain datafiles or secJons from other datafiles.
The most comprehensive Oracle applications & technology content under one roof
MulJsecJon Backups
• Benefits – Improved performance for backup and restore.
• Befer performance when restoring one datafile compared to restoring from large mulJplexed backup set
– Befer restartability. • Restart the failed secJon backup instead of datafile
The most comprehensive Oracle applications & technology content under one roof
MulJsecJon Backups
The most comprehensive Oracle applications & technology content under one roof
MulJsecJon Backups
The most comprehensive Oracle applications & technology content under one roof
MulJsecJon Backups
The most comprehensive Oracle applications & technology content under one roof
DATABASE RESIDENT CONNECTION POOL
The most comprehensive Oracle applications & technology content under one roof
DATABASE RESIDENT CONNECTION POOL
• Shared Server or MTS – Session Resources are not shared – Good for long running transacJons
• Database resident connecJon pool(DRCP) – To support large number of similar client applicaJons or connecJons
– Share or reuse sessions. – TransacJons are very short in nature – No Session affinity is required
The most comprehensive Oracle applications & technology content under one roof
DATABASE RESIDENT CONNECTION POOL
• DRCP is mainly intended for single threaded applicaJons like PHP , PERL – Currently available to clients that use the OCI driver with C, C++, Perl and PHP.
– No support for JDBC thin or JDBC-‐OCI. • More database connecJons are supported compared to
shared server or dedicated server configuraJon – Less memory foot print – Behaves more like dedicated server connecJon once the connecJon is established.
The most comprehensive Oracle applications & technology content under one roof
Database Resident ConnecGon Pool
• Working of DRCP 1. Client makes a request for connecJon 2. Background process connecJon broker picks up
appropriate pooled server and hands-‐off the client to that pooled server.
3. Once connecJon is handed-‐off, the client directly communicates with the pooled server
4. The pooled server is handed back to the broker when the client releases it.
The most comprehensive Oracle applications & technology content under one roof
DATABASE RESIDENT CONNECTION POOL
• Working of DRCP
PGA POOLED SERVERS
Clients/Middle Ger
ConnecGon Broker
The most comprehensive Oracle applications & technology content under one roof
DATABASE RESIDENT CONNECTION POOL
• How to configure? – Start the pool with DBMS_CONNECTION_POOL.START_POOL();
– Add (SERVER = POOLED) to TNS entry – You can also use the following syntax for PHP
• oci_pconnect(“userid", “pwd", “hostname:1526/orcl:POOLED"); – Pool can be stopped with DBMS_CONNECTION_POOL.STOP_POOL();
– Pool properJes like minimum and maximum number of pooled servers , maximum inacJvity Jme etc. can be specified with DBMS_CONNECTION_POOL . CONFIGURE_POOL package
The most comprehensive Oracle applications & technology content under one roof
Server ConsolidaGon
The most comprehensive Oracle applications & technology content under one roof
Server ConsolidaJon • Very simple and effecJve approach to Server ConsolidaJon
• Limit the CPU used by an Instance – Works by limiJng the number of runnable processes
• Administered and maintained by DBA instead of SA’s
• Supports over-‐provisioning • Will not help with licensing if your server has more CPU’s (At least for now, please check with Oracle)
The most comprehensive Oracle applications & technology content under one roof
Server ConsolidaJon
• How to enable instance caging? – Enable the Resource Manager.
• ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = ‘DEFAULT_PLAN;
– Set the CPU_COUNT iniJalizaJon parameter. • ALTER SYSTEM SET CPU_COUNT = 2;
The most comprehensive Oracle applications & technology content under one roof
Server ConsolidaJon
• What is the secret formula? – CPU_COUNT/Total number of acJve instances
• Example: 8 CPU server with 4 instances – Each instance is limited to 2 CPU(CPU_COUNT) – CASE-‐1: If all 4 instances are acJve
• Each instance gets 2/(4*2) =25% of Total CPU – CASE-‐2: If 2 instances are acJve
• Each instance gets 2/(2*2) = 50% of Total CPU
The most comprehensive Oracle applications & technology content under one roof
SQL*Plus Error Logging
The most comprehensive Oracle applications & technology content under one roof
SQL*Plus Error Logging • Records SQL, PL/SQL and SQL*Plus errors in an error table – Default table is SPERRORLOG; – Created automaJcally if the table does not exists
• Captures errors that are not SQL too. – SELCT instead of SELECT
• This is SQL*Plus feature and works with older versions of Oracle database – Only the clients must be 11g or above
• Is it Jme to say bye bye to spooling, Wait not yet
The most comprehensive Oracle applications & technology content under one roof
SQL*Plus Error Logging
• All you have to do is type “SET ERRORLOGGING ON”
• Allows you to idenJfy the session with idenJfier – SET ERRORLOGGING ON IDENTIFIER ‘Core-‐Release 2.3’
• Allows use of user-‐defined table • SET ERRORLOGGING ON TABLE scof.errorlog
• Allows truncaJng of tables before capturing errors – SET ERRORLOGGING ON TRUNCATE
The most comprehensive Oracle applications & technology content under one roof
SQL*Plus Error Logging
The most comprehensive Oracle applications & technology content under one roof
Preprocessor
The most comprehensive Oracle applications & technology content under one roof
Oracle Preprocessor
• Provides the ability to preprocess your data before sending to Oracle external drivers – Reduced disk space consumpJon and faster processing Jme.
– Adds befer control and flexibility to external tables
The most comprehensive Oracle applications & technology content under one roof
Oracle Preprocessor
• Supports OS commands, binaries and scripts • Supports parallelism – File is granular unit for parallelism.
• Back ported to 10.2.0.5 • Other uses – For SQL lovers , run vmstat , df –k or sar report from SQL prompt.
• CauJon – Restrict access to preprocessor directory
The most comprehensive Oracle applications & technology content under one roof
Oracle Preprocessor
The most comprehensive Oracle applications & technology content under one roof
References
• Oracle DocumentaJon • Oracle Metalink • asktom.oracle.com • OTN ArJcles • hfp://opJmizermagic.blogspot.com • hfp://kkempf.wordpress.com • hfp://php.net/manual/en/oci8.connecJon.php • And many more …..