среда, 15 декабря 2010 г.

TPITR

1) Not possible for tablespaces with rollback segments in
select distinct tablespace_name from dba_rollback_segs;
2) Tablespace containging dependencies
select * from (select TS1_NAME from ts_pitr_check union select TS2_NAME from ts_pitr_check) where ts1_name <> '-1';

gurantee restore point without flashback on

-- sqlplus
shutdown immediate;
startup mount;
create restore point test_p guarantee flashback database;
-- in db_recovery_file_dest
$ls -la
total 8008
drwxrwxrwx 1 user group 0 Dec 15 16:00 .
drwxrwxrwx 1 user group 0 Dec 15 13:01 ..
-rw-rw-rw- 1 user group 8200192 Dec 15 16:21 O1_MF_6JKQ7HHV_.FLB
-- sqlplus
drop table SYS_TEMP_FBT;
-- rman
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> flashback database to restore point test_p;
-- sqlplus and table back :)
alter database open read only;
desc SYS_TEMP_FBT
Name Null? Type
------------------------------------------- --------
...

Advisor: log size

-- !!! fast_start_mttr_target should be set !!!
-- Optimal and actual size of log in MB
select distinct o.optimal_logfile_size omb, l.bytes/1024/1024 amb from v$instance_recovery o, v$log l;

вторник, 14 декабря 2010 г.

Hash cluster

Hash function applied to key and locates the needed block (for select or update)

-- When to use
1) Rows with the same key are located in the same area on disk
2) Mostly equal predicates used for the key

Better than table/index because for that needed:
1) One or more I/O to find entry in index
2) One or more I/O to find entry in table

FRA

-- Space usage
select name, space_used/1024/1024 um, space_reclaimable/1024/1024 m, space_limit/1024/1024 ml from v$recovery_file_dest;
-- Delete unneeded archivelogs from OS
rmam
-- Crosscheck
crosscheck archivelog all;
-- List
list expired archivelog all;
-- Delete
delete expired archivelog all

resync catalog, error in doc 10g

doc

RMAN> resync catalog;

new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> resync catalog;

starting full resync of recovery catalog
full resync complete

-- And that form does not work (but would be really useful)
RMAN> RESYNC CONTROLFILE FROM CONTROLFILECOPY '/tmp/cfile.dbf';

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "controlfile": expecting one of: "catalog"
RMAN-01007: at line 1 column 8 file: standard input

понедельник, 13 декабря 2010 г.

set initial consumer group for user

-- Create consumer group
exec dbms_resource_manager.create_pending_area;
exec dbms_resource_manager.create_consumer_group('test', 'test');
-- Try to set for user test
09:36:37 159 4294967295 SYS@orcl> exec dbms_resource_manager.set_initial_consumer_group('test', 'test');
ORA-29368: consumer group TEST does not exist
-- Need to submit pending area
exec dbms_resource_manager.submit_pending_area;
-- But...
exec dbms_resource_manager.set_initial_consumer_group('test', 'test');
ORA-29399: user TEST does not have privilege to switch to consumer group TEST
-- Grant privilege
exec dbms_resource_manager_privs.grant_switch_consumer_group('test', 'test', false);
-- And we are done
exec dbms_resource_manager.set_initial_consumer_group('test', 'test');

Update BLOB

set define off DECLARE    vb1 CLOB := 'long text';    vb2 CLOB :=                 'long text';    vb3 CLOB :=              ...