RMAN password encryption video
I just added RMAN password configuration, How to configure and Its working.
Jun 23
I just added RMAN password configuration, How to configure and Its working.
An instance(crash) failure occurs when your database isn’t able to shutdown normally.When this happens, your datafiles could be in an inconsistent state meaning they may not contain all committed changes and may contain uncommitted changes. Instance failures occur when the isntance terminates abnormally. A sudden power failure or a shutdown abort are two common causes of isntance failure.
Oracle uses crash recovery to return the database to a consistent committed state after an instance failure. Crash recovery guarntees that when your database is opened, it will contain only transactions that were committted before the instance failure occured. Oracle system monitor will automatically detect whether crash recovery is required.
Crash recovery has two pahses : rollforward and rollback
The system monitor will first roll forward and apply to the datafiles any transactions in the online redo files that occured after the most recent checkpoint. Crash Recovery uses redo information found in the online redo log files onlu . After rolling forward, Oracle will rollback any of those transactions that were never committed. Oracle uses information stored in the undo segments to rollback (undo) any uncommitted transactions.
When you start your database, Oracle uses the SCN information in the control files and datafiles headers to determin which one of the following will occur.
Starting up normally.
Performing crash Recovery
Determining that media reocvery is required.
On start up , Oracle check the instance thread status to determine whether crash recover is required . When the database is open for normal operations ,the thread status is OPEN. When Oracle us shut down normally , a checkpoint takes place and the instance thread status is set to CLOSED.
when your instance abnormally terminates the thread status remains OPEN because Oracle didn’t get a chance to upodate teh status to CLOSED.
On startup , When Oracle detects that an instance thread was abnormally left open, the system monitor process will automatically perform crash recovery.
The below query , it will usefull to find out whether crash recovery is required.
select a.thread#,b.open_mode,a.status,
CASE
WHEN((b.open_mode=’MOUNTED’) AND (a.status=’OPEN’)) THEN ‘Crash Recovery req.’
WHEN((b.open_mode=’MOUNTED’) AND (a.status=’CLOSED’)) THEN ‘No Crash Recovery Req.’
WHEN((b.open_mode=’READ WRITE’) AND (a.status=’OPEN’)) THEN ‘Instance already open’
ELSE ‘huh?’
END STATUS
FROM v$thread a,
v$database b,
v$instance c
where a.thread#=c.thread#;
Just a Example :
1.
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 306184656 bytes
Database Buffers 222298112 bytes
Redo Buffers 5804032 bytes
Database mounted.
Database opened.
SQL> ED
Wrote file afiedt.buf
1 select
2 a.thread#,b.open_mode,a.status,
3 CASE
4 WHEN ((b.open_mode=’MOUNTED’) AND (a.status=’OPEN’)) THEN ‘Crash Recovery r
eq.’
5 WHEN ((b.open_mode=’MOUNTED’) AND (a.status=’CLOSED’)) THEN ‘No Crash Recov
ery Req.’
6 WHEN ((b.open_mode=’READ WRITE’) AND (a.status=’OPEN’)) THEN ‘Instance alre
ady open’
7 ELSE ‘huh?’
8 END STATUS
9 FROM v$thread a,
10 v$database b,
11 v$instance c
12* where a.thread#=c.thread#
SQL> /
THREAD# OPEN_MODE STATUS STATUS
———- ——————– —— ———————-
1 READ WRITE OPEN Instance already open
2.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 306184656 bytes
Database Buffers 222298112 bytes
Redo Buffers 5804032 bytes
Database mounted.
SQL> select a.thread#,b.open_mode,a.status,
2 CASE
3 WHEN((b.open_mode=’MOUNTED’) AND (a.status=’OPEN’)) THEN ‘Crash Recovery re
q.’
4 WHEN((b.open_mode=’MOUNTED’) AND (a.status=’CLOSED’)) THEN ‘No Crash Recove
ry Req.’
5 WHEN((b.open_mode=’READ WRITE’) AND (a.status=’OPEN’)) THEN ‘Instance alrea
dy open’
6 ELSE ‘huh?’
7 END STATUS
8 FROM v$thread a,
9 v$database b,
10 v$instance c
11 where a.thread#=c.thread#;
THREAD# OPEN_MODE STATUS STATUS
———- ——————– —— ———————-
1 MOUNTED CLOSED No Crash Recovery Req.
SQL>
3.
SQL> SHUTDOWN ABORT
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 306184656 bytes
Database Buffers 222298112 bytes
Redo Buffers 5804032 bytes
Database mounted.
SQL> ed
Wrote file afiedt.buf
1 select a.thread#,b.open_mode,a.status,
2 CASE
3 WHEN((b.open_mode=’MOUNTED’) AND (a.status=’OPEN’)) THEN ‘Crash Recovery re
q.’
4 WHEN((b.open_mode=’MOUNTED’) AND (a.status=’CLOSED’)) THEN ‘No Crash Recove
ry Req.’
5 WHEN((b.open_mode=’READ WRITE’) AND (a.status=’OPEN’)) THEN ‘Instance alrea
dy open’
6 ELSE ‘huh?’
7 END STATUS
8 FROM v$thread a,
9 v$database b,
10 v$instance c
11* where a.thread#=c.thread#
SQL> /
THREAD# OPEN_MODE STATUS STATUS
———- ——————– —— ———————-
1 MOUNTED OPEN Crash Recovery req.
Jun 9
Using a recovery catalog makes it startightforward to restore the controlfile.When you issue the restore controlfile command, RMAN will retieve from teh recovery catalog the location and name of the file that contains the control file backup and restores the control file approproately.
Because the recovery catalog knows the location of the RMAN backups piece, It doesn’t matter whether the backup piece is in a flash recovery area or in a configured channel location.
When you’re connected to the recovery catalog, you can view backup information about your control files even while your target database is in nomount mode. To list backups of your controlfiles ,use the lsit command as shown here.
RMAN>connect target /
RMAN>connect catalog backup/backup@recover
RMAN>startup nomount
RMAN>list backup of ocntrolfile;
If you have registered two database in the recovery datalog with the same name, then you might receive an error such as this when you attempt to list backups or restore the control file
RMAN-06004: ORACLE error from recovery catalog database
RMAN-20005: target database name is ambiguous
In this situation, you will need to first set your database identifier(dbid) before you can restore your control file.
How to determine your DBID
You can verify that you have multiple databases with the same name in your recovery catalog by querying the recovery catalog RC_DATABASE view
sql>connect backup/backup@recover;
sql> select db_key,dbid,name from rc_database;
DB_KEY DBID NAME
——- —– ——-
1 1124743449 TEST
4241 1140772490 TEST
Jun 8
Active/Passive
An active/passive cluster generally contain two identical nodes.At any time, one of the nodes is active and the other is passive.Oracle singel instance database software is installed on both nodes, but the database is located on shared storage.During normal operation, the Oracle database instance runs only on the active node.In the event of a failure of the currently active primary system,clustering software will transfer control of the disk subsystem to the secondary system, a process known as failover.As part of the failover process, the Oracle instance on the secondary nose is started, thereby recovering and resuming the service of the Oracle database. All connections to the instance on the primary system at the time of failure are terminated and must be reestablished withe the new instance on the secondary system.On resolution of the issue, the Oracle instance is cleanly shut down on the secondary system , control of the disk subsystem is transfered back to the primary system and oracle instance is started to resume normal operations.
a number of third party products are avilable to implement active /passive clustering on linux.
Active/Active
An active /active cluster has an identical hardware infrastruture to an active /passive one. However, Oracle instances run concurrenlty on both servers and access the same database. which is located on shared storage. The instances must communicated with each other to negotiate access to shared data in the database. In the event of a server failure, the remaining server can continue processing the workload and optionally failed sessions can be reconnected . the benefit of an active / active cluster over an active/passive cluster is that,during normal processing, the workload can be shared across both servers in the cluster
Oracle RAC is desighned to run in an active / active enviornment.
Today I went to attend the my first day class about Oracle Real Application Cluster. The class taken by Mr.Syed Jaffar Hussian.I thought Why i want to explain about himself.Because almost all of them(oracle Community) know about him,He is one of the famous person and outstanding DBA in this world.However I briefly explain about my trainer.He is an Oracle Certified Master (First person in Saudi Arabia) and He also Oracle ACE member and he is one of the author of upcoming book of Oracle R1/R2 RAC handbook and He is reviewer of Oracle books and he given seminar for some Organization about RMAN and RAC .I hope I will become a RAC expert after finish this course.
Today He given overviwed about Course Agenda what he will take class in future..
Cluster Introduction with its advantages.
What is Oracle RAC?
Oracle RAC architecture
Advantage of Oracle RAC
Single instance and RAC
Installation Prequistes like Hardware, Network , Storage, OS groups and users and SSH/RCP preconfiguration
Cluster utility (cluvfy) overview and usage
RAC Installation – Clustware ,ASM and RDBMS
RAC Database Creation
Common Initilization Parameters
OCR (oracle cluster registry) & Voting Disk
Enabling and Disabling automatic cluster stack start and stop
Clustware administration
RAC workload management and services -Hig avilbilty, load balance
RAC internals
Troublshooting – Node eviction Issues
Performance Tuning
Node addition and Deletion
Single instance database conversion to RAC
New features of 11g R2.
Jun 5
You want to encrypt the backups made with RMAN in order to meet your organization’s security guidelines.By default,all RMAN backups are unencrypted but you can encrypt any RMAN backup in the form of a backup set.You can encrypt sets in two ways transparent encryption and password encryption.Here I’m going to show How to configure Password encryption.
Password Encryption :
RMAN perform encrypted backups by using the set encryption command. This method is called password encryption of backups since the DBA must provide a password both for creating an encrypted backup and for restoring an encrypted backup.
RMAN> set encryption on identified by azar only;
executing command: SET encryption
Here I choosed one tablespace for encryption.
RMAN> configure encryption for tablespace users on;
tablespace USERS will be encrypted in future backup sets
new RMAN configuration parameters are successfully stored
RMAN> backup tablespace users;
Starting backup at 05-JUN-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf
channel ORA_DISK_1: starting piece 1 at 05-JUN-10
channel ORA_DISK_1: finished piece 1 at 05-JUN-10
piece handle=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYDB/backupset/2010_06_05/o1_mf_nnndf_TAG20100605T154958_60nkzpxn_.bkp tag=TAG20100605T154958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-JUN-10
RMAN> sql ‘alter tablespace users offline’;
sql statement: alter tablespace users offline
RMAN> restore tablespace users;
Starting restore at 05-JUN-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=148 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYDB/backupset/2010_06_05/o1_mf_nnndf_TAG20100605T154958_60nkzpxn_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/05/2010 15:55:29
ORA-19870: error reading backup piece /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYDB/backupset/2010_06_05/o1_mf_nnndf_TAG20100605T154958_60nkzpxn_.bkp
ORA-19913: unable to decrypt backup
So we need to set decryption.
RMAN> set decryption identified by azar;
executing command: SET decryption
RMAN> restore tablespace users;
Starting restore at 05-JUN-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYDB/backupset/2010_06_05/o1_mf_nnndf_TAG20100605T154958_60nkzpxn_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYDB/backupset/2010_06_05/o1_mf_nnndf_TAG20100605T154958_60nkzpxn_.bkp tag=TAG20100605T154958
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 05-JUN-10
RMAN> recover tablespace users;
Starting recover at 05-JUN-10
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 05-JUN-10
RMAN> sql ‘alter tablespace users online’;
sql statement: alter tablespace users online
RMAN>
All of the members of a current online redo log group in your database have experience media failure.
You lose all members of a current online redo log group. Here are possible reasons,
SQL> select group#,status,archived,thread#,sequence# from v$log;
GROUP# STATUS ARC THREAD# SEQUENCE#
———- —————- — ———- ———-
1 CURRENT NO 1 17
2 INACTIVE YES 1 15
3 INACTIVE YES 1 16
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1:
‘/home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/redo01.log’
ORA-00312: online log 1 thread 1:
‘/home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/redo01a.log’
SQL> select group#,status,archived,thread#,sequence# from v$log;
GROUP# STATUS ARC THREAD# SEQUENCE#
———- —————- — ———- ———-
1 CURRENT NO 1 17
3 INACTIVE YES 1 16
2 INACTIVE YES 1 15
SQL> alter system checkpoint;
alter system checkpoint
*
ERROR at line 1:
ORA-01109: database not open
First determine the last good SCN by querying the first_change# column from v$log, you’re missing only the current online redo logs, therfore you can perform an incomplete recovery up tobut not including,
SQL> select group#,status,archived,thread#,sequence#,first_change# from v$log;
GROUP# STATUS ARC THREAD# SEQUENCE# FIRST_CHANGE#
———- —————- — ———- ———- ————-
1 CURRENT NO 1 17 574131
3 INACTIVE YES 1 16 574125
2 INACTIVE YES 1 15 574103
SQL>
In this case, you can restore and recover up to but not including, 574131
Operation :-
Losing all members of your current online redo log group is arguably the worst thing taht can happen to your database. if you experience media failure with all members of the current online redo group, then you will lose any transactions contained in those logs. in this case, you will have to perform incomplete recovery before you can open your database.
[oracle@localhost root]$ rlwrap rman target sys/azar
Recovery Manager: Release 10.2.0.1.0 – Production on Mon May 31 10:51:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST (DBID=2015564632, not open)
RMAN> restore database until scn 574131;
Starting restore at 31-MAY-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=150 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/system01.dbf
restoring datafile 00002 to /home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/undotbs01.dbf
restoring datafile 00003 to /home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/sysaux01.dbf
restoring datafile 00004 to /home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/backupset/2010_05_25/o1_mf_nnndf_TAG20100525T103307_5zpz9nft_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/backupset/2010_05_25/o1_mf_nnndf_TAG20100525T103307_5zpz9nft_.bkp tag=TAG20100525T103307
channel ORA_DISK_1: restore complete, elapsed time: 00:01:37
Finished restore at 31-MAY-10
RMAN> recover database until scn 574131;
Starting recover at 31-MAY-10
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 7 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_25/o1_mf_1_7_5zpzh95q_.arc
archive log thread 1 sequence 8 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_8_606k8n7x_.arc
archive log thread 1 sequence 9 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_9_606lkvgy_.arc
archive log thread 1 sequence 10 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_10_606mfskg_.arc
archive log thread 1 sequence 11 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_11_606ndqvj_.arc
archive log thread 1 sequence 12 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_12_606szwxo_.arc
archive log thread 1 sequence 13 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_13_606t3zs8_.arc
archive log thread 1 sequence 14 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_14_606t777d_.arc
archive log thread 1 sequence 15 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_15_606t908r_.arc
archive log thread 1 sequence 16 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_16_606t9jd0_.arc
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_25/o1_mf_1_7_5zpzh95q_.arc thread=1 sequence=7
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_8_606k8n7x_.arc thread=1 sequence=8
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_9_606lkvgy_.arc thread=1 sequence=9
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_10_606mfskg_.arc thread=1 sequence=10
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_11_606ndqvj_.arc thread=1 sequence=11
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_12_606szwxo_.arc thread=1 sequence=12
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_13_606t3zs8_.arc thread=1 sequence=13
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/TEST/archivelog/2010_05_31/o1_mf_1_14_606t777d_.arc thread=1 sequence=14
media recovery complete, elapsed time: 00:00:06
Finished recover at 31-MAY-10
RMAN> alter database open resetlogs;
database opened.
SQL> select status from v$instance;
STATUS
————
OPEN
SQL> select group#,members,status from v$log;
GROUP# MEMBERS STATUS
———- ———- —————-
1 2 INACTIVE
2 2 CURRENT
3 2 UNUSED
You’re attempting to open your database and receive this message
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1:
‘/home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/redo02.log’
ORA-00312: online log 2 thread 1:
‘/home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/redo02a.log’
The message indicates that two members of an online redo log group in your database have experienced a media failure.
To recoveer when you’ve lost all members of an inactive redo log group, perform the following steps
Verify that all members of a group have been damaged.
Verify that the log group status is INACTIVE.
Recreate the log group with the clear logfile command.
If the recreated log group has not been archived,then immediately backup up your database.
SQL> select group#,members,status from v$log;
GROUP# MEMBERS STATUS
———- ———- —————-
1 2 CURRENT
2 2 INACTIVE
3 2 ACTIVE
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
(Here I manually deleted redolog files members of group 2)
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1:
‘/home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/redo02.log’
ORA-00312: online log 2 thread 1:
‘/home/oracle/oracle/product/10.2.0/db_1/oradata/TEST/redo02a.log’
If all members of an online redo log group are damaged, you won’t be able to open your database, oracle will allow you to only mount your database.
SQL> select status from v$instance;
STATUS
————
MOUNTED
SQL> select group#,status,archived,thread#,sequence# from v$log;
GROUP# STATUS ARC THREAD# SEQUENCE#
———- —————- — ———- ———-
1 CURRENT NO 1 11
3 INACTIVE YES 1 10
2 INACTIVE YES 1 9
If the status is INACTIVE ,then this log group is no longer needed for crash recovery , therefore ,you can use the clear logfile command to recreate all members of a log group.
SQL> alter database clear logfile group 2;
Database altered.
If the group has not been archived, then you will need to use the clear unarchived logfile command as follows.
SQL> alter database clear unarchived logfile group 2;
Database altered.
If the cleared log group had not been previously archived, it’s critical that you immediately create a backup of your database.
SQL> alter database open;
Database altered.
SQL> select group#,status,archived,thread#,sequence# from v$log;
GROUP# STATUS ARC THREAD# SEQUENCE#
———- —————- — ———- ———-
1 INACTIVE YES 1 11
2 CURRENT NO 1 12
3 INACTIVE YES 1 10
SQL>
You want to transport tablespaces using RMAN backups instead of performing the transportable tablespaces operation on the live production database.
Source Database : MYTEST
Target Database : MYDB
Transportable Tablespace : TRANSPORT
The following example shows how to transport tablespaces on identical operating system platforms by utilizing RMAN backups.
Step 1: Make sure the tablespaces you plan to transport are self contained. To be considered self contained, the tablespaces se you want to transport
muchn’t contain references pointing outside those tablespaces, such as an index on a table that doesn’t belong to one of the tablespaces you’re transporting.
SQL> execute sys.dbms_tts.transport_set_check(‘transport’,TRUE);
PL/SQL procedure successfully completed.
Step 2: Generate the transportable tablespace set by issuing the transport tablespace command.
RMAN> transport tablespace ‘TRANSPORT’
2> tablespace destination ‘/home/oracle/oracle/transporttbs’
3> auxiliary destination ‘/home/oracle/oracle/auxdest’;
Creating automatic instance, with SID=’gjEd’
initialization parameters used for automatic instance:
db_name=MYTEST
compatible=10.2.0.1.0
db_block_size=8192
db_files=200
db_unique_name=tspitr_MYTEST_gjEd
large_pool_size=1M
shared_pool_size=110M
#No auxiliary parameter file used
db_create_file_dest=/home/oracle/oracle/auxdest
control_files=/home/oracle/oracle/auxdest/cntrl_tspitr_MYTEST_gjEd.f
starting up automatic instance MYTEST
Oracle instance started
Total System Global Area 201326592 bytes
Fixed Size 1218508 bytes
Variable Size 146802740 bytes
Database Buffers 50331648 bytes
Redo Buffers 2973696 bytes
Automatic instance created
contents of Memory Script:
{
# set the until clause
set until scn 580515;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone ‘alter database mount clone database’;
# archive current online log for tspitr to a resent until time
sql ‘alter system archive log current’;
# avoid unnecessary autobackups for structural changes during TSPITR
sql ‘begin dbms_backup_restore.AutoBackupFlag(FALSE); end;’;
# resync catalog after controlfile restore
resync catalog;
}
executing Memory Script
executing command: SET until clause
Starting restore at 29-MAY-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=37 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/autobackup/2010_05_29/o1_mf_s_720285190_60216pdz_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/autobackup/2010_05_29/o1_mf_s_720285190_60216pdz_.bkp tag=TAG20100529T151310
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/home/oracle/oracle/auxdest/cntrl_tspitr_MYTEST_gjEd.f
Finished restore at 29-MAY-10
sql statement: alter database mount clone database
sql statement: alter system archive log current
sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;
starting full resync of recovery catalog
full resync complete
released channel: ORA_DISK_1
released channel: ORA_AUX_DISK_1
contents of Memory Script:
{
# generated tablespace point-in-time recovery script
# set the until clause
set until scn 580515;
# set an omf destination filename for restore
set newname for clone datafile 1 to new;
# set an omf destination filename for restore
set newname for clone datafile 2 to new;
# set an omf destination filename for restore
set newname for clone datafile 3 to new;
# set an omf destination tempfile
set newname for clone tempfile 1 to new;
# set a destination filename for restore
set newname for datafile 8 to
“/home/oracle/oracle/transporttbs/transport01.dbf”;
# rename all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set plus the auxilliary tablespaces
restore clone datafile 1, 2, 3, 8;
switch clone datafile all;
#online the datafiles restored or flipped
sql clone “alter database datafile 1 online”;
#online the datafiles restored or flipped
sql clone “alter database datafile 2 online”;
#online the datafiles restored or flipped
sql clone “alter database datafile 3 online”;
#online the datafiles restored or flipped
sql clone “alter database datafile 8 online”;
# make the controlfile point at the restored datafiles, then recover them
recover clone database tablespace “TRANSPORT”, “SYSTEM”, “UNDOTBS1”, “SYSAUX” delete archivelog;
alter clone database open resetlogs;
# PLUG HERE the creation of a temporary tablespace if export fails due to lack
# of temporary space.
# For example in Unix these two lines would do that:
#sql clone “create tablespace aux_tspitr_tmp
# datafile ”/tmp/aux_tspitr_tmp.dbf” size 500K”;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed temporary file 1 to /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_temp_%u_.tmp in control file
Starting restore at 29-MAY-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=39 devtype=DISK
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_system_%u_.dbf
restoring datafile 00002 to /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_undotbs1_%u_.dbf
restoring datafile 00003 to /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_sysaux_%u_.dbf
restoring datafile 00008 to /home/oracle/oracle/transporttbs/transport01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/backupset/2010_05_29/o1_mf_nnndf_TAG20100529T154405_60230pbp_.bkp
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/backupset/2010_05_29/o1_mf_nnndf_TAG20100529T154405_60230pbp_.bkp tag=TAG20100529T154405
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:38
Finished restore at 29-MAY-10
datafile 1 switched to datafile copy
input datafile copy recid=9 stamp=720287348 filename=/home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_system_602372kr_.dbf
datafile 2 switched to datafile copy
input datafile copy recid=10 stamp=720287348 filename=/home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_undotbs1_602372qx_.dbf
datafile 3 switched to datafile copy
input datafile copy recid=11 stamp=720287348 filename=/home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_sysaux_602372o0_.dbf
datafile 8 switched to datafile copy
input datafile copy recid=12 stamp=720287348 filename=/home/oracle/oracle/transporttbs/transport01.dbf
sql statement: alter database datafile 1 online
sql statement: alter database datafile 2 online
sql statement: alter database datafile 3 online
sql statement: alter database datafile 8 online
Starting recover at 29-MAY-10
using channel ORA_AUX_DISK_1
starting media recovery
archive log thread 1 sequence 15 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/archivelog/2010_05_29/o1_mf_1_15_6022vddo_.arc
archive log thread 1 sequence 16 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/archivelog/2010_05_29/o1_mf_1_16_60235d3p_.arc
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/archivelog/2010_05_29/o1_mf_1_15_6022vddo_.arc thread=1 sequence=15
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/archivelog/2010_05_29/o1_mf_1_16_60235d3p_.arc thread=1 sequence=16
media recovery complete, elapsed time: 00:00:03
Finished recover at 29-MAY-10
database opened
contents of Memory Script:
{
#mark read only the tablespace that will be exported
sql clone “alter tablespace TRANSPORT read only”;
# create directory for datapump export
sql clone “create or replace directory STREAMS_DIROBJ_DPDIR as ”
/home/oracle/oracle/transporttbs””;
# export the tablespaces in the recovery set
host ‘expdp userid=\”/@\(DESCRIPTION=\(ADDRESS=\(PROTOCOL=beq\)\(PROGRAM=/home/oracle/oracle/product/10.2.0/db_1/bin/oracle\)\(ARGV0=oraclegjEd\)\(ARGS=^’\(DESCRIPTION=\(LOCAL=YES\)\(ADDRESS=\(PROTOCOL=beq\)\)\)^’\)\(ENVS=^’ORACLE_SID=gjEd^’\)\)\(CONNECT_DATA=\(SID=gjEd\)\)\) as sysdba\” transport_tablespaces=
TRANSPORT dumpfile=
dmpfile.dmp directory=
STREAMS_DIROBJ_DPDIR logfile=
explog.log’;
}
executing Memory Script
sql statement: alter tablespace TRANSPORT read only
sql statement: create or replace directory STREAMS_DIROBJ_DPDIR as ”/home/oracle/oracle/transporttbs”
Export: Release 10.2.0.1.0 – Production on Saturday, 29 May, 2010 15:49:28
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
Starting “SYS”.”SYS_EXPORT_TRANSPORTABLE_01″: userid=”/********@(DESCRIPTION=(ADDRESS=(PROTOCOL=beq)(PROGRAM=/home/oracle/oracle/product/10.2.0/db_1/bin/oracle)(ARGV0=oraclegjEd)(ARGS=\(DESCRIPTION=\(LOCAL=YES\)\(ADDRESS=\(PROTOCOL=beq\)\)\))(ENVS=ORACLE_SID=gjEd))(CONNECT_DATA=(SID=gjEd))) AS SYSDBA” transport_tablespaces= TRANSPORT dumpfile=dmpfile.dmp directory=STREAMS_DIROBJ_DPDIR logfile=explog.log
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Master table “SYS”.”SYS_EXPORT_TRANSPORTABLE_01″ successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
/home/oracle/oracle/transporttbs/dmpfile.dmp
Job “SYS”.”SYS_EXPORT_TRANSPORTABLE_01″ successfully completed at 15:49:48
host command complete
/*
The following command may be used to import the tablespaces.
Substitute values for <logon> and <directory>.
impdp <logon> directory=<directory> dumpfile= ‘dmpfile.dmp’ transport_datafiles= /home/oracle/oracle/transporttbs/transport01.dbf
*/
————————————————————–
— Start of sample PL/SQL script for importing the tablespaces
————————————————————–
— creating directory objects
CREATE DIRECTORY STREAMS$DIROBJ$1 AS ‘/home/oracle/oracle/transporttbs/’;
CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS ‘/home/oracle/oracle/transporttbs’;
/* PL/SQL Script to import the exported tablespaces */
DECLARE
— the datafiles
tbs_files dbms_streams_tablespace_adm.file_set;
cvt_files dbms_streams_tablespace_adm.file_set;
— the dumpfile to import
dump_file dbms_streams_tablespace_adm.file;
dp_job_name VARCHAR2(30) := NULL;
— names of tablespaces that were imported
ts_names dbms_streams_tablespace_adm.tablespace_set;
BEGIN
— dump file name and location
dump_file.file_name := ‘dmpfile.dmp’;
dump_file.directory_object := ‘STREAMS$DIROBJ$DPDIR’;
— forming list of datafiles for import
tbs_files( 1).file_name := ‘transport01.dbf’;
tbs_files( 1).directory_object := ‘STREAMS$DIROBJ$1’;
— import tablespaces
dbms_streams_tablespace_adm.attach_tablespaces(
datapump_job_name => dp_job_name,
dump_file => dump_file,
tablespace_files => tbs_files,
converted_files => cvt_files,
tablespace_names => ts_names);
— output names of imported tablespaces
IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN
FOR i IN ts_names.first .. ts_names.last LOOP
dbms_output.put_line(‘imported tablespace ‘|| ts_names(i));
END LOOP;
END IF;
END;
/
— dropping directory objects
DROP DIRECTORY STREAMS$DIROBJ$1;
DROP DIRECTORY STREAMS$DIROBJ$DPDIR;
————————————————————–
— End of sample PL/SQL script
————————————————————–
Removing automatic instance
shutting down automatic instance
Oracle instance shut down
Automatic instance removed
auxiliary instance file /home/oracle/oracle/auxdest/cntrl_tspitr_MYTEST_gjEd.f deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_system_602372kr_.dbf deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_undotbs1_602372qx_.dbf deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_sysaux_602372o0_.dbf deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/datafile/o1_mf_temp_6023bh4x_.tmp deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/onlinelog/o1_mf_1_6023b963_.log deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/onlinelog/o1_mf_2_6023bb7g_.log deleted
auxiliary instance file /home/oracle/oracle/auxdest/TSPITR_MYTEST_GJED/onlinelog/o1_mf_3_6023bc3y_.log deleted
Operation :
Step 4: Run import script files to target database. The script files generated when you’re done tablespace transport command used by rman , source database.
RMAN> SQL> select name from v$database;
NAME
———
MYDB
SQL> conn system/azar@mydb
Connected.
SQL> CREATE DIRECTORY STREAMS$DIROBJ$1 AS ‘/home/oracle/oracle/transporttbs/’;
Directory created.
SQL> CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS ‘/home/oracle/oracle/transporttbs’;
Directory created.
SQL>DECLARE
— the datafiles
tbs_files dbms_streams_tablespace_adm.file_set;
cvt_files dbms_streams_tablespace_adm.file_set;
— the dumpfile to import
dump_file dbms_streams_tablespace_adm.file;
dp_job_name VARCHAR2(30) := NULL;
— names of tablespaces that were imported
ts_names dbms_streams_tablespace_adm.tablespace_set;
BEGIN
— dump file name and location
dump_file.file_name := ‘dmpfile.dmp’;
dump_file.directory_object := ‘STREAMS$DIROBJ$DPDIR’;
— forming list of datafiles for import
tbs_files( 1).file_name := ‘transport01.dbf’;
tbs_files( 1).directory_object := ‘STREAMS$DIROBJ$1’;
— import tablespaces
dbms_streams_tablespace_adm.attach_tablespaces(
datapump_job_name => dp_job_name,
dump_file => dump_file,
tablespace_files => tbs_files,
converted_files => cvt_files,
tablespace_names => ts_names);
— output names of imported tablespaces
IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN
FOR i IN ts_names.first .. ts_names.last LOOP
dbms_output.put_line(‘imported tablespace ‘|| ts_names(i));
END LOOP;
END IF;
END;
31 /
PL/SQL procedure successfully completed.
SQL> select tablespace_name from dba_data_files;
TABLESPACE_NAME
——————————
SYSTEM
UNDOTBS1
SYSAUX
USERS
TRANSPORT
SQL>
Possible Error :-
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of tranport tablespace command at 05/29/2010 15:36:00
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20202: tablespace not found in the recovery catalog
If you don’t have backup copy of your transportable tablespace in RMAN backupsets, the above error will be shown.
May 25
You want to use RMAN to create a duplicate database on the same server by using RMAN backups.
My Source Database Name is MYTEST
Target (duplicate) Database name is MYDB
Step 1: Configure Listener.ora and tnsnames.ora files
tnsnames.ora file
MYTEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mytest)
)
)
MYDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = mydb)
)
)
listener.ora file
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = mytest)
(ORACLE_HOME = /home/oracle/oracle/product/10.2.0/db_1)
(SID_NAME = mytest)
)
(SID_DESC =
(GLOBAL_DBNAME= mydb)
(ORACLE_HOME = /home/oracle/oracle/product/10.2.0/db_1)
(SID_NAME = mydb)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
)
)
Step 2: create pfile for target database from source database
SQL> create pfile from spfile;
File created.
Step 3: modified parameter file for target database (duplicate) here log_file_name_convert and db_file_name_convert and control file location is important, further your choice.
*.audit_file_dest=’/home/oracle/oracle/product/10.2.0/db_1/admin/mydb/adump’
*.compatible=’10.2.0.1.0′
*.db_block_size=8192
*.db_domain=”
*.db_file_multiblock_read_count=16
*.db_name=’mydb’
*.control_files=’/home/oracle/oracle/product/10.2.0/oradata/mydb/control01.ctl’,’/home/oracle/oracle/product/10.2.0/oradata/mydb/control02.ctl’,’/home/oracle/oracle/product/10.2.0/oradata/mydb/control03.ctl’
*.db_file_name_convert=’/home/oracle/oracle/product/10.2.0/db_1/oradata/mytest’,’/home/oracle/oracle/product/10.2.0/oradata/mydb’
*.log_file_name_convert=’/home/oracle/oracle/product/10.2.0/db_1/oradata/mytest’,’/home/oracle/oracle/product/10.2.0/oradata/mydb’
*.db_recovery_file_dest=’/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area’
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=mydbXDB)’
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_target=285212672
*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS1′
Step 4: Create password file
[oracle@localhost ~]$orapwd file=orapwmydb password=oracle entries=5
Step 5: start your target database nomount stage
[oracle@localhost ~]$ export ORACLE_SID=mydb
[oracle@localhost ~]$ rlwrap sqlplus
SQL*Plus: Release 10.2.0.1.0 – Production on Tue May 25 18:22:09 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: sys/oracle@mydb as sysdba
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
SQL> startup nomount pfile=/home/oracle/oracle/product/10.2.0/db_1/dbs/initmydb.ora
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
SQL> exit
Step 6: From source database
SQL> alter system switch logfile;
System altered.
SQL>
Step 7: Backup database and archivelog Source database
[oracle@localhost root]$ rlwrap rman target sys/azar@mytest
Recovery Manager: Release 10.2.0.1.0 – Production on Tue May 25 19:56:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: MYTEST (DBID=2419076664)
RMAN> backup database plus archivelog;
Starting backup at 25-MAY-10
current log archived
input datafile fno=00001 name=/home/oracle/oracle/product/10.2.0/db_1/oradata/mytest/system01.dbf
input datafile fno=00003 name=/home/oracle/oracle/product/10.2.0/db_1/oradata/mytest/sysaux01.dbf
input datafile fno=00002 name=/home/oracle/oracle/product/10.2.0/db_1/oradata/mytest/undotbs01.dbf
input datafile fno=00004 name=/home/oracle/oracle/product/10.2.0/db_1/oradata/mytest/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-MAY-10
channel ORA_DISK_1: finished piece 1 at 25-MAY-10
(skipped)
Starting Control File and SPFILE Autobackup at 25-MAY-10
piece handle=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/autobackup/2010_05_25/o1_mf_s_719956316_5zr01f85_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-MAY-10
Step 8: Connect auxiliary database
RMAN> connect auxiliary sys/oracle@mydb;
connected to auxiliary database: MYDB (not mounted)
Step 9: Create duplicate database.
RMAN> duplicate target database to mydb;
Starting Duplicate Db at 25-MAY-10
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
contents of Memory Script:
{
set until scn 470310;
set newname for datafile 1 to
“/home/oracle/oracle/product/10.2.0/oradata/mydb/system01.dbf”;
set newname for datafile 2 to
“/home/oracle/oracle/product/10.2.0/oradata/mydb/undotbs01.dbf”;
set newname for datafile 3 to
“/home/oracle/oracle/product/10.2.0/oradata/mydb/sysaux01.dbf”;
set newname for datafile 4 to
“/home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf”;
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 25-MAY-10
using channel ORA_AUX_DISK_1
skipping datafile 1; already restored to file /home/oracle/oracle/product/10.2.0/oradata/mydb/system01.dbf
skipping datafile 2; already restored to file /home/oracle/oracle/product/10.2.0/oradata/mydb/undotbs01.dbf
skipping datafile 3; already restored to file /home/oracle/oracle/product/10.2.0/oradata/mydb/sysaux01.dbf
skipping datafile 4; already restored to file /home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf
restore not done; all files readonly, offline, or already restored
Finished restore at 25-MAY-10
sql statement: CREATE CONTROLFILE REUSE SET DATABASE “MYDB” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( ‘/home/oracle/oracle/product/10.2.0/oradata/mydb/redo01.log’ ) SIZE 50 M REUSE,
GROUP 2 ( ‘/home/oracle/oracle/product/10.2.0/oradata/mydb/redo02.log’ ) SIZE 50 M REUSE,
GROUP 3 ( ‘/home/oracle/oracle/product/10.2.0/oradata/mydb/redo03.log’ ) SIZE 50 M REUSE
DATAFILE
‘/home/oracle/oracle/product/10.2.0/oradata/mydb/system01.dbf’
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=719956582 filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=719956582 filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=719956582 filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf
contents of Memory Script:
{
set until scn 470310;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 25-MAY-10
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK
starting media recovery
archive log thread 1 sequence 9 is already on disk as file /home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/archivelog/2010_05_25/o1_mf_1_9_5zr01bl8_.arc
archive log filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/MYTEST/archivelog/2010_05_25/o1_mf_1_9_5zr01bl8_.arc thread=1 sequence=9
media recovery complete, elapsed time: 00:00:02
Finished recover at 25-MAY-10
contents of Memory Script:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE “MYDB” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( ‘/home/oracle/oracle/product/10.2.0/oradata/mydb/redo01.log’ ) SIZE 50 M REUSE,
GROUP 2 ( ‘/home/oracle/oracle/product/10.2.0/oradata/mydb/redo02.log’ ) SIZE 50 M REUSE,
GROUP 3 ( ‘/home/oracle/oracle/product/10.2.0/oradata/mydb/redo03.log’ ) SIZE 50 M REUSE
DATAFILE
‘/home/oracle/oracle/product/10.2.0/oradata/mydb/system01.dbf’
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
set newname for tempfile 1 to
“/home/oracle/oracle/product/10.2.0/oradata/mydb/temp01.dbf”;
switch clone tempfile all;
catalog clone datafilecopy “/home/oracle/oracle/product/10.2.0/oradata/mydb/undotbs01.dbf”;
catalog clone datafilecopy “/home/oracle/oracle/product/10.2.0/oradata/mydb/sysaux01.dbf”;
catalog clone datafilecopy “/home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf”;
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /home/oracle/oracle/product/10.2.0/oradata/mydb/temp01.dbf in control file
cataloged datafile copy
datafile copy filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/undotbs01.dbf recid=1 stamp=719956593
cataloged datafile copy
datafile copy filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/sysaux01.dbf recid=2 stamp=719956593
cataloged datafile copy
datafile copy filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf recid=3 stamp=719956593
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=719956593 filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=719956593 filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=719956593 filename=/home/oracle/oracle/product/10.2.0/oradata/mydb/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 25-MAY-10
RMAN>
Step 10: My duplicate database succesfully created.
Enter user-name: sys/oracle@mydb as sysdba
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
SQL> select status from v$instance;
STATUS
————
OPEN
SQL> select name from V$database;
NAME
———
MYDB
SQL>