Oracle 10g New Features Quick Guide
Oracle 10g New Features Quick Guide
Oracle 10g New Features Quick Guide
1. Flashback Table
a. Revival of dropped table.
b. It’s like windows’ recycle bin which stores deleted data. Same way in Oracle
10g Recyclebin is maintaining.
c. The table and its associated objects are placed in a logiacal container known
as the ‘recycle bin’
d. Commands Used:
i. Select * from tab; (which shows dropped table list. Like BIN$.....)
ii. Show recyclebin; (will show the original table name & drop time)
e. We can take the table back as original using following command.
i. Flashback table <table_name> to before drop;
ii. Select * from tab;
f. We can Purge recyclebin or a table from recyclebin
i. Purge recyclebin;
ii. Drop table <table_name> purge;
g. When a tablespace is completely filled up with recycle bin data such that the
datafiles have to extend to make room for more data, the tablespace is said
to be under “space pressure”. In that scenario, objects are automatically
purged from the recycle bin in a first-first-out manner.
2. Tablespace Management
a. Oracle Database 10g introduces a new tablespace called SYSAUX that holds
the objects of DBSNMP, ODM etc. schemas. This tablespace is created
automatically during database creation and is locally managed. Objects in
SYSAUX can be recovered as any normal user object while the database itself
remains operational.
b. Renaming a tablespace
i. You can simply rename an existing tablesapce (System & Sysaux
excepted), whether permanent or temporary, usin the following
command.
ALTER TABLESPACE <OLDNAME> RENAME TO <NEWNAME>;
CURRENT_SCN TO_CHAR(SYSTIMESTAM
----------- -------------------
722452 2004-03-29 13:34:12
COUNT(*)
----------
1
COUNT(*)
----------
0
COUNT(*)
----------
0
CURRENT_SCN TO_CHAR(SYSTIMESTAM
----------- -------------------
725202 2004-03-29 14:59:08
CURRENT_SCN TO_CHAR(SYSTIMESTAM
----------- -------------------
725219 2004-03-29 14:59:36
COLUMN versions_startscn FORMAT 99999999999999999
COLUMN versions_starttime FORMAT A24
COLUMN versions_endscn FORMAT 99999999999999999
COLUMN versions_endtime FORMAT A24
COLUMN versions_xid FORMAT A16
COLUMN versions_operation FORMAT A1
COLUMN description FORMAT A11
SET LINESIZE 200
2 rows selected.
d. Flashback Table:
i. The FLASHBACK TABLE command allows point in time recovery of
individual tables subject to the following requirements:
1. You must have either FLASHBACK ANY TABLE system privilege
or have FLASHBACK object privilege on the table.
2. You must have SELECT, INSERT, DELETE and ALTER privilege
on the table.
3. There must be enough information in the und tablespace to
complete the operation.
4. Row movement must be enabled on the table. (ALTER TABLE
<TABLE_NAME> ENABLE ROW MOVEMENT;)
CURRENT_SCN
-----------
715340
COUNT(*)
----------
0
COUNT(*)
----------
1
e. Flashback Database:
i. The FLASHBACK DATABASE command is a fast alternative to
performing and incomplete recovery. In order to flashback the
database you must have SYSDBA privilege and the flash recovery area
must have been prepared advance.
ii. If the database in NOARCHIVELOG it must be switched to
ARCHIVELOG mode.
-- Flashback 5 minutes.
CONN sys/password AS SYSDBA
SHUTDOWN IMMEDIATE
STARTUP MOUNT EXCLUSIVE
FLASHBACK DATABASE TO TIMESTAMP SYSDATE-(1/24/12);
ALTER DATABASE OPEN RESETLOGS;
iii. The window oaf time that is available for flashback is determined by
the DB_FLASHBACK_RETENTION_TARGET parameter. The maximum
flashback can be determined by querying the
V$FLASHBACK_DATABASE_LOG view.
iv. It is only possible to flashback to a point in time after flashback was
enabled.
5 rows selected.
TABLESPACE_NAME RETENTION
------------------------------ -----------
SYSTEM NOT APPLY
UNDOTBS1 NOGUARANTEE
SYSAUX NOT APPLY
TEMP NOT APPLY
USERS NOT APPLY
5 rows selected.
-- Recover space, but don't amend the high water mark (HWM).
ALTER TABLE scott.emp SHRINK SPACE COMPACT;
b. The shrink will accomplish by moving rows between blocks, hence the
requirement for row movement to be enabled for the shrink to take place.
This can cause problem with ROWID based triggers.
c. The shrinking process is only available for objects in tablespaces with
automatic segment space management enabled.
Shared_pool_size = 0
Large_pool_size = 0
Java_pool_size = 0
Db_create_size = 0