DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
2008 Collaborate IOUG Presentation
1. Oracle11g: Rest of the
New Features for DBA
Biju Thomas
OneNeck IT Services Corporation
Session #328
http://www.oneneck.com
2. Introducing OneNeck
The ERP Outsourcing Experts
Provide a comprehensive, flexible suite of outsourcing
solutions designed specifically to help mid-market and
public sector organizations
• Supporting over 30,000 users at over 850 sites worldwide
• Primary data center/support center operations in Phoenix
and Houston
• Hosting and managing over 1000 databases
• 99% Contract Renewal Rate over 10 years
• 100% US based operations and staff
• 24x7x365 support center handling over 50,000 tickets
annually
• Oracle certified hosting partner
• Ranked #1 ERP Outsourcing Vendor by the Black Book of
Outsourcing two years in a row
• http://www.OneNeck.com
• Stop by booth 1271
3. About the Speaker
• Senior Database Administrator at OneNeck IT
Services Corporation (www.oneneck.com)
• More than 14 years of Oracle experience
• Co-author of Oracle10g (New Features), Oracle9i
(SQL & Admin) and Oracle8i (SQL & Admin)
certification guides published by Sybex/Wiley
• Published articles in Oracle Magazine, Oracle
Internals and Select Journal
• Oracle 7, 8i, 9i, 10g OCP Administrator
• Oracle Database SQL Certified Expert
4. Objectives
• Review Oracle11g features that are not top-10
• Discuss the new features that are out-of-the-box in
Oracle11g Enterprise Edition
• Concentrate on the features that are simple and easy
to implement
• Identify the changes in behavior from Oracle10g
7. Passwords are Case Sensitive
• New users created in Oracle11g have case
sensitive password.
• When upgrading from pre-11 release, case
sensitivity takes effect when you change
password.
• PASSWORD_VERSIONS and PASSWORD
columns in DBA_USERS.
• Disable case sensitivity by setting
SEC_CASE_SENSITIVE_LOGON to FALSE.
• ORAPWD has a new parameter –
IGNORECASE.
8. Passwords and DB Links
• Since passwords are case sensitive in
Oracle11g, careful with the DB Links from
pre-11g database to 11g database.
• The account in Oracle11g should have
password in uppercase when linking from
pre-11g database.
To pre-11g To 11g
From Pre-11g Doesn’t Matter Upper Case
From 11g Doesn’t Matter Same Case
9. Users with default password
select * from
• New view to list the users with dba_users_with_defpwd;
default password.
USERNAME
---------------------
DIP
• DBA_USERS_WITH_DEFPWD MDSYS
has only one column – WK_TEST
USERNAME. CTXSYS
HR
OUTLN
EXFSYS
SCOTT
MDDATA
ORDPLUGINS
ORDSYS
XDB
SI_INFORMTN_SCHEMA
WMSYS
14 rows selected.
10. Changes to DEFAULT Profile
• PASSWORD_LIFE_TIME is 180
• PASSWORD_LOCK_TIME is 1
• PASSWORD_GRACE_TIME is 7
• ?/rdbms/admin/utlpwdmg.sql creates
VERIFY_FUNCTION_11G, with enhanced
password complexity checking.
11. Default Auditing
• AUDIT_TRAIL parameter is set to DB
• ALTER SYTEM, ALTER USER, ALTER
DATABASE, ALTER PROFILE actions are
audited.
• CREATE USER, DROP USER, DROP
PROFILE actions are audited.
• Logins are audited (CREATE SESSION).
• Most “ANY” privilege actions are audited.
• Delete on AUD$ is audited and such records
cannot be deleted.
12. Actions Audited
ALTER ANY PROCEDURE CREATE ANY JOB DROP ANY TABLE
ALTER ANY TABLE CREATE ANY LIBRARY DROP PROFILE
ALTER DATABASE CREATE ANY PROCEDURE DROP USER
ALTER PROFILE CREATE ANY TABLE EXEMPT ACCESS POLICY
GRANT ANY OBJECT
AUDIT ROLE BY ACCESS CREATE EXTERNAL JOB
PRIVILEGE
CREATE PUBLIC DATABASE
ALTER SYSTEM GRANT ANY PRIVILEGE
LINK
ALTER USER CREATE SESSION GRANT ANY ROLE
AUDIT SYSTEM CREATE USER
AUDIT SYSTEM BY ACCESS DROP ANY PROCEDURE
13. DDL in Alert Log
• To log all DDL operations in the alert log file, set the
parameter ENABLE_DDL_LOGGING.
• The default value is FALSE, means DDL logging is
disabled.
• Can be changed using ALTER SESSION or ALTER
SYSTEM
Wed Jan 30 11:21:11 2008
create table bthomas.test_table (nn number)
Wed Jan 30 11:27:34 2008
alter table bthomas.test_table modify (nn varchar2 (10))
Wed Jan 30 11:29:43 2008
drop table bthomas.test_table
15. Where is the alert log?
• Automatic Diagnostic Repository (ADR) keeps all the
log and trace files.
• DIAGNOSTIC_DEST parameter replaces
BACKGROUND_DUMP_DEST,
USER_DUMP_DEST and CORE_DUMP_DEST
parameters.
• DIAGNOSTIC_DEST defaults to ORACLE_BASE if
set, else ORACLE_HOME/log.
• Alert log is under
DIAGNOSTIC_DEST/diag/rdbms/database/instance/t
race. The XML version is under ../alert.
16. File Locations
• The USER/BACKGROUND/CORE_DUMP_DEST
values are ignored by Oracle11g.
• V$DIAG_INFO gives file locations.
select name, value from v$diag_info;
NAME VALUE
------------------------- --------------------------------------------
Diag Enabled TRUE
ADR Base c:oracle
ADR Home c:oraclediagrdbmsw11gr1w11gr1
Diag Trace c:oraclediagrdbmsw11gr1w11gr1trace
Diag Alert c:oraclediagrdbmsw11gr1w11gr1alert
Diag Incident c:oraclediagrdbmsw11gr1w11gr1incident
Diag Cdump c:oraclediagrdbmsw11gr1w11gr1cdump
Health Monitor c:oraclediagrdbmsw11gr1w11gr1hm
Default Trace File c:oraclediagrdbmsw11gr1w11gr1trace
w11gr1_ora_6036.trc
Active Problem Count 3
Active Incident Count 1
17. Parameter - Default Value Changes
Parameter 10g 11g
LOG_ARCHIVE_MAX_PROCESSES 2 4
SESSION_CACHED_CURSORS 0 50
JOB_QUEUE_PROCESSES 10 1000
AUDIT_TRAIL NONE DB
UNDO_MANAGEMENT MANUAL AUTO
18. Memory Configuration
• New parameters – MEMORY_TARGET and
MEMORY_MAX_TARGET.
• No need to specify SGA size
(SGA_TARGET) and PGA size
(PGA_AGGREGATE_TARGET) separately.
• If SGA and PGA parameters are not set, the
default initial allocation is 60% SGA and 40%
PGA.
• New view – V$MEMORY_TARGET_ADVICE.
19. Memory Configuration - 2
• The V$MEMORY_DYNAMIC_COMPONENTS view
shows the summarized information on all resize
operations and shows the current sizes of all SGA
components.
• If you set the MEMORY_TARGET to a non-zero
value, Oracle will manage memory automatically. The
MEMORY_MAX_TARGET will default to the value of
MEMORY_TARGET.
• If you have also set SGA_TARGET and
PGA_AGGREGATE_TARGET parameters, those
values will be considered the minimums.
20. Parameter File from Memory
• In pre-Oracle11g releases, we can create
pfile from spfile or spfile from pfile.
• In Oracle11g, we can now create spfile or
pfile from memory
CREATE
PFILE='/u01/oracle/admin/DB1/pfile/in
itDB1.ora' FROM MEMORY;
CREATE SPFILE FROM MEMORY;
21. RESET Clause in ALTER SYSTEM
• In pre-Oracle11g releases, the RESET clause
required SID= clause.
ALTER SYSTEM RESET UTL_FILE_DIR SID=*
SCOPE=SPFILE;
• In Oracle11g, SID= is optional.
ALTER SYSTEM RESET UTL_FILE_DIR;
• In Oracle11g, SCOPE=SPFILE is only valid
option for SCOPE and is the default. In
Oracle10g, BOTH was the default and BOTH,
MEMORY, SPFILE were valid options.
23. Shrink Temporary Tablespaces
• Option to shrink a temporary tablepace
• Option to shrink a temporary tablespace file
• New view DBA_TEMP_FREE_SPACE
alter tablespace temp shrink space keep 18M;
alter tablespace temp shrink space;
alter tablespace temp shrink tempfile
'c:oracleoradataw11gr1temp01.dbf' keep 20M;
select * from dba_temp_free_space;
TABLESPACE_NAME TABLESPACE_SIZE ALLOCATED_SPACE FREE_SPACE
--------------- --------------- --------------- ----------
TEMP 52494336 2162688 51380224
24. Read-only Tables
• New ALTER TABLE clause to make a table read-
only.
• If you try to perform insert or update or delete on
read-only table, you get an ORA-12081 error.
• Flashback, Truncate not allowed.
• Drop table, drop indexes, drop constraints allowed.
ALTER TABLE <table_name> READ ONLY;
ALTER TABLE <table_name> READ WRITE;
select owner, table_name, tablespace_name
from dba_tables
where read_only = 'YES';
25. Add NOT NULL column
• When NOT NULL column with DEFAULT
value is added to a table, no update
performed on existing rows.
• Only dictionary is updated
• Same syntax, different behavior
• When you query an existing record from the
table, Oracle optimizer will apply the filter
predicate NVL(<column_name>,
<default_value>) before returning the record
26. Tablespace for GTT
• In pre-Oracle11g releases, the global temporary table
segments where created in the user’s default
temporary tablespace.
• In Oracle11g, you can specify a tablespace for global
temporary tablespace segments.
create global temporary table customer_stage (
cust_name number (10),
col1 varchar2 (40),
col2 varchar2 (60))
on commit preserve rows
tablespace temp;
27. Invisible Indexes
• If you want to test the implications of creating
an index without affecting the application, you
can make the index invisible. After testing,
you may drop the index or make it visible.
• To make the optimizer use invisible index, set
the OPTIMIZER_USE_INVISIBLE_INDEXES
to TRUE in the session.
• INVISIBLE/VISIBLE clause is added to
CREATE INDEX and ALTER INDEX
statements.
28. Invisible Indexes - 2
SQL> create index hr.employee_test on hr.employee (first_name) invisible;
Index created.
SQL> select index_name, visibility from dba_indexes
2 where owner = 'HR' and table_name = 'EMPLOYEE';
INDEX_NAME VISIBILIT
------------------------------ ---------
PK_EMPLOYEE VISIBLE
EMPLOYEE_TEST INVISIBLE
SQL> select first_name, last_name from hr.employee
2 where first_name = 'John';
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3 | 78 | 3 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| EMPLOYEE | 3 | 78 | 3 (0)| 00:00:01 |
------------------------------------------------------------------------------
SQL> alter session set optimizer_use_invisible_indexes = true;
Session altered.
SQL> select first_name, last_name from hr.employee
2 where first_name = 'John';
-------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU
-------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 3 | 78 | 2 (0
| 1 | TABLE ACCESS BY INDEX ROWID| EMPLOYEE | 3 | 78 | 2 (0
|* 2 | INDEX RANGE SCAN | EMPLOYEE_TEST | 3 | | 1 (0
-------------------------------------------------------------------------------
29. Wait for DDL Lock
• New parameter to specify the DDL lock wait
time – DDL_LOCK_TIMEOUT
• Value specified in seconds, default is 0, max
1,000,000.
• Parameter can be changed using ALTER
SYSTEM or ALTER SESSION.
• When the timeout expires, error returned as
in previous releases.
ORA-00054: resource busy and
acquire with NOWAIT specified or
timeout expired
30. LOCK TABLE Enhancement
• The LOCK TABLE statement is enhanced to
include a WAIT clause.
• You can now specify how many seconds you
want the database to wait before returning
the “resource busy” error.
LOCK TABLE <table_name> IN
EXCLUSIVE MODE WAIT 120;
10:20
31. DBMS_STATS Enhancements
• New procedures to set table, schema, database and
global preferences for statistics collection. This
replaces the SET_PARAM procedure in Oracle10g.
• New preferences
– PUBLISH: Pending Statistics Feature
– STALE_PERCENT: Adjust Staleness Threshold
– INCREMENTAL: For Partitioned Table Statistics
• Extended Statistics
– Multi-column
– Expression column
• Report differences between statistics collected
• Resume statistics gathering if aborted earlier
33. Staleness Threshold
• If GATHER_STALE option is specified when
gathering statistics, Oracle looks for 10% of rows
changed in the table to collect new statistics.
• In 11g, using the SET_.._PREFS procedures, this
default can be changed globally or at db, schema,
table level.
SQL> exec dbms_stats.set_table_prefs('SH',
'CUSTOMERS', 'STALE_PERCENT', '20');
SQL> select table_name, preference_name,
preference_value from dba_tab_stat_prefs;
TABLE_NAME PREFERENCE_NAME PREFERENCE_VALUE
------------ ----------------- -----------------
CUSTOMERS STALE_PERCENT 20
34. Pending Statistics
• Test implication of new statistics before making it available to all users
SQL> exec dbms_stats.set_table_prefs('HR', 'EMPLOYEES',
'PUBLISH', 'FALSE');
SQL> exec dbms_stats.gather_table_stats('HR', 'EMPLOYEES');
SQL> select table_name, num_rows, blocks, sample_size
from dba_tab_pending_stats;
TABLE_NAME NUM_ROWS BLOCKS SAMPLE_SIZE
--------------------- -------- ------ -----------
EMPLOYEES 107 5 107
SQL> alter session set optimizer_use_pending_statistics =
true;
SQL> exec dbms_stats.publish_pending_stats( 'HR',
'EMPLOYEES');
SQL> exec dbms_stats.delete_pending_stats( 'HR',
'EMPLOYEES'); 10:30
35. Multi-column Statistics
• Tell optimizer relationship between columns
• CUSTOMERS table is populated and has about 91000 rows. Statistics collected
on the table with the “FOR ALL ROWS SIZE AUTO” option.
SQL> select column_name, num_distinct, histogram
2 from dba_tab_col_statistics
3 where owner = 'BTHOMAS' and table_name = 'CUSTOMERS';
COLUMN_NAME NUM_DISTINCT HISTOGRAM
------------------ ------------ ---------------
CUST_COUNTRY 3 FREQUENCY
CUST_STATE 6 FREQUENCY
CUST_NAME 47692 NONE
SQL>
SQL> select * from customers where cust_country = 'India' and
cust_state = 'TN';
-------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |
-------------------------------------------------------
| 0 | SELECT STATEMENT | | 1447 | 41963 |
|* 1 | TABLE ACCESS FULL| CUSTOMERS | 1447 | 41963 |
-------------------------------------------------------
36. Multi-columns Stats - 2
SQL> select dbms_stats.create_extended_stats('BTHOMAS','CUSTOMERS',
2 '(CUST_COUNTRY, CUST_STATE)') from dual;
DBMS_STATS.CREATE_EXTENDED_STATS('BTHOMAS','CUSTOMERS','(CUST
-------------------------------------------------------------
SYS_STUZVS6GX30A0GN_5YRYSD2LPM
SQL> exec dbms_stats.gather_table_stats(null, 'customers',
method_opt=>'for all columns size skewonly');
=====================================================================
SQL> exec dbms_stats.gather_table_stats(null, 'customers',
method_opt=>'for all columns size skewonly
for columns (cust_country, cust_state)');
SQL> select extension_name, extension from user_stat_extensions
2 where table_name = 'CUSTOMERS';
EXTENSION_NAME EXTENSION
------------------------------------ -----------------------------
SYS_STUZVS6GX30A0GN_5YRYSD2LPM ("CUST_COUNTRY","CUST_STATE")
38. SQL*Plus
• On Windows, SQLPLUSW.EXE replaced with SQL
Developer, SQLPLUS.EXE still available.
• SQL*Plus error logging to write ORA, PLS and SP2
errors – Default table name is SPERRORLOG.
SET ERRORL[OGGING] {ON|OFF} [TABLE [schema.]tablename]
[TRUNCATE] [IDENTIFIER identifier]
SQL> desc sperrorlog
Name Null? Type
---------------------- -------- ----------------
USERNAME VARCHAR2(256)
TIMESTAMP TIMESTAMP(6)
SCRIPT VARCHAR2(1024)
IDENTIFIER VARCHAR2(256)
MESSAGE CLOB
STATEMENT CLOB
• CONNECT AS SYSASM, in addition to SYSDBA and
SYSOPER
39. What Else to Try/Read?
• Database Replay • Flashback Data Archive
• Interval and Reference • Flashback Transaction
Partitions • Automatic Diagnostic
• SQL Query Result Cache Repository & ADRCI
• SQL Performance Analyzer • Data Recovery Advisor
• SQL Plan Baseline • Active DB Duplication
• Automatic SQL Tuning • Multi-section backups
• Snapshot Standby • Lightweight Jobs in
Scheduler
• Active Data Guard
• Fine grained dependency
• OLTP Table Compression
tracking
• AutoTask Infrastructure
• DBMS_COMPARE
• Virtual Columns
• DBMS_HM
40. Questions…???
And… Thank You For Your Time
• Please complete the session evaluation form
– Biju Thomas
– Oracle11g: Rest of New Features for DBA
– Session # 328
• Further questions, comments…
– Stop by Booth #1271
– WWW.ONENECK.COM