RESTORE and RECOVER an Oracle Database to a New Host With a New Database Name

Perform Disaster Recovery on your Database: Oracle Backup and Recovery - RMAN, User Managed Backups, Oracle Secure Backup (OSB), OSB Express, etc.
Post Reply
User avatar
Kristoff
Posts: 30
Joined: Thu Jan 19, 2012 2:17 pm
Location: Manila, Philippines

RESTORE and RECOVER an Oracle Database to a New Host With a New Database Name

Post by Kristoff »

This scenario assumes the following:

Two networked machines, dgprim and dgstan, are running Red Hat Enterprise Linux AS release 4
Oracle version 10.2.0.5.0 is installed on both machine.
A media management subsystem is accessible by both machines specifically Symantec Veritas NetBackup
The directory structure of dgstan is different from dgprim, so that source database (GELLEE) is located in +VOL1/ (ASM), but you want to restore the database to /u02/oradata/ (Non-ASM)
A target database named GELLEEis on dgprim and uses a recovery catalog RCAT11G
Database GELLEE uses a server parameter file (not a client-side initialization parameter file)
You want to test the restore and recovery of GELLEE on dgstan, while keeping database GELLEE up and running on dgprim
The ORACLE_SID for the source database is GELLEE and will be changed to GELLEE3 for the restored database
You have recoverable backups on tape of all datafiles
You have backups of the archived logs required to recover the datafiles
You have control file and server parameter file autobackups on tape
You have a record of the DBID for GELLEE (Connect to your catalog DB and query: select * from rc_database order by NAME;)

Procedure:
1. MAKE BACKUP TAPES accessible to DESTINATION HOST (dgstan)
Contact your NETBACKUP system administrators to the source database BACKUP TAPES accessible to DESTINATION HOST

2. Verify by the following command on destination host
a) Login oracle@dgstan
b) /usr/openv/netbackup/bin/bplist -C dgprim -S [media_server] -t 4 -l -R /
Contact your Netbackup admin for the correct [media_server]
The above bplist command should list all the backup sets that are in the RMAN catalog
c.) As soon as the backup sets are accessible to destination host, proceed to step 3.

3. From destination host, set the correct ORACLE_HOME and ORACLE_SID to its NEW database name.
Ensure that there no other instance running the same as the one to be restored.
[GELLEE3 /home/oracle]$ export ORACLE_SID=GELLEE3
[GELLEE3 /home/oracle]$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[GELLEE3 /home/oracle]$ echo $ORACLE_SID
GELLEE3
[GELLEE3 /home/oracle]$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1
4. Ensure you know the DBID of your source database. Refer to your RMAN backup logs. In this case the DBID for GELLEE is 830948345
You can also query it from your recover catalog database.
[GELLEE /home/oracle]$ sqlplus /nolog
SQL> connect rman11/rman11@rcat11g
Connected.
SQL> select * from rc_database order by NAME;

Code: Select all

SQL> select * from rc_database order by NAME;

    DB_KEY  DBINC_KEY       DBID NAME     RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
         2        956 1366358822 AUX11G             1093476 16-SEP-12
      1421       1422  830948345 GELLEE              383537 18-SEP-12
5. From destination host,
a) RMAN connect to target. Destination database is not yet started on this part
[GELLEE /home/oracle]$ rman target /
[GELLEE /home/oracle]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Fri Sep 21 07:00:29 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database (not started)
b) Connect to recovery catalog
RMAN> connect catalog rman11/rman11@rcat11g
RMAN> connect catalog rman11/rman11@rcat11g

connected to recovery catalog database
c) Set the DBID to source database
RMAN> SET DBID 830948345
RMAN> SET DBID 830948345

executing command: SET DBID
database name is "GELLEE" and DBID is 830948345
d) Startup in nomount mode. Since you don't have any pfile or spfile yet, it will use a dummy spfile
RMAN> startup nomount;
RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initGELLEE3.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started

Total System Global Area 159383552 bytes

Fixed Size 1272552 bytes
Variable Size 58721560 bytes
Database Buffers 96468992 bytes
Redo Buffers 2920448 bytes
e) List backup of spfile
RMAN> list backup of spfile;
RMAN> list backup of spfile;


List of Backup Sets
===================

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1593 Full 6.80M DISK 00:00:06 21-SEP-12
BP Key: 1596 Status: AVAILABLE Compressed: NO Tag: TAG20120921T055643
Piece Name: /u03/backup/7_794555880
SPFILE Included: Modification time: 21-SEP-12
f) Restore spfile to a pfile . By default, it will restore the latest backed up spfile.
RMAN> restore spfile to pfile '?/dbs/initGELLEE3.ora' for DB_UNIQUE_NAME GELLEE;
RMAN> restore spfile to '?/dbs/initGELLEE3.ora' for DB_UNIQUE_NAME GELLEE;

Starting restore at 21-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=37 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=?/dbs/spfileGELLEE3.ora
channel ORA_DISK_1: reading from backup piece /u03/backup/GELLEE_26_794576582
channel ORA_DISK_1: restored backup piece 1
piece handle=/u03/backup/GELLEE_26_794576582 tag=TAG20120921T114155
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
released channel: ORA_DISK_1
Finished restore at 21-SEP-12

g) Restart in nomount mode using the previously restored spfile
RMAN> shutdown immediate;
RMAN> sql 'create spfile from pfile';
RMAN> startup nomount;
RMAN> startup nomount;

Oracle instance started

Total System Global Area 167772160 bytes

Fixed Size 1272600 bytes
Variable Size 62915816 bytes
Database Buffers 100663296 bytes
Redo Buffers 2920448 bytes
h) Restore controlfile to a new location:
RMAN> restore controlfile to '/u02/oradata/GELLEE3/controlfile/control01.ctl';
i) Create a pfile from the current spfile
RMAN> sql 'create pfile from spfile';
j) Shutdown database
RMAN> shutdown immediate;
i) Edit the pfile to reflect the new location of controlfile, db_create_file_dest, log_archive_dest_1 and db_unique_name
Verify that all directories found in parameter file are available.
vi initGELLEE3.ora
*.audit_file_dest='/u01/app/oracle/admin/GELLEE3/adump'
*.background_dump_dest='/u01/app/oracle/admin/GELLEE3/bdump'
*.compatible='10.2.0.5.0'
*.control_files='/u02/oradata/GELLEE3/controlfile/control01.ctl'
*.core_dump_dest='/u01/app/oracle/admin/GELLEE3/cdump'
*.db_block_size=8192
*.db_create_file_dest='/u02/oradata/'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='GELLEE'
*.db_unique_name='GELLEE3'
*.db_recovery_file_dest='/u02/oradata/'
*.db_recovery_file_dest_size=2147483648
*.job_queue_processes=10
*.log_archive_dest_1='LOCATION=/u02/oradata/'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/GELLEE3/udump'
j) Recreate the spfile
SQL> create spfile from pfile='initGELLEE3.ora';
k) Startup in mount mode
SQL> startup mount;
SQL> startup mount;
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1272600 bytes
Variable Size 62915816 bytes
Database Buffers 100663296 bytes
Redo Buffers 2920448 bytes
Database mounted.
Here, db_name is the source database name and db_unique_name and the destination database name.
SQL> show parameter db_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string GELLEE
SQL> show parameter db_unique

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string GELLEE
l) Connect RMAN to target then connect to recovery catalog database
rman target /
[GELLEE3 /u01/app/oracle/product/10.2.0/db_1/dbs]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Fri Sep 21 12:00:06 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: GELLEE (DBID=830948345, not open)
RMAN> connect catalog rman11/rman11@rcat11g
RMAN> connect catalog rman11/rman11@rcat11g

connected to recovery catalog database
m) Preview database restoration. Take note of the latest Low SCN of archivelogs to be restored and recovered.
RMAN> restore database preview;
RMAN> restore database preview;

Starting restore at 21-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK


List of Datafile Copies
Key File S Completion Time Ckp SCN Ckp Time Name
------- ---- - --------------- ---------- --------------- ----
1 1 A 21-SEP-12 444419 21-SEP-12 /u02/oradata/GELLEE/system.438.794355759
3 2 A 21-SEP-12 444419 21-SEP-12 /u02/oradata/GELLEE/undotbs1.436.794355763
2 3 A 21-SEP-12 444419 21-SEP-12 /u02/oradata/GELLEE/sysaux.437.794355761
4 4 A 21-SEP-12 444419 21-SEP-12 /u02/oradata/GELLEE/users.435.794355763
using channel ORA_DISK_1

no backup of log thread 1 seq 7 lowscn 432337 found to restore

List of Backup Sets
===================

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5 94.50K DISK 00:00:01 21-SEP-12
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20120921T055637
Piece Name: /u03/backup/5_794555800

List of Archived Logs in backup set 5
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 8 461016 21-SEP-12 461443 21-SEP-12

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
8 2.50K DISK 00:00:01 21-SEP-12
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20120921T055814
Piece Name: /u03/backup/8_794555895

List of Archived Logs in backup set 8
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 9 461443 21-SEP-12 461494 21-SEP-12

BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
9 1.23M DISK 00:00:02 21-SEP-12
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20120921T060230
Piece Name: /u03/backup/9_794556151

List of Archived Logs in backup set 9
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 10 461494 21-SEP-12 461544 21-SEP-12
1 11 461544 21-SEP-12 461546 21-SEP-12
1 12 461546 21-SEP-12 461548 21-SEP-12
1 13 461548 21-SEP-12 461550 21-SEP-12
1 14 461550 21-SEP-12 461552 21-SEP-12
1 15 461552 21-SEP-12 461554 21-SEP-12
1 16 461554 21-SEP-12 461556 21-SEP-12
1 17 461556 21-SEP-12 461558 21-SEP-12
1 18 461558 21-SEP-12 461560 21-SEP-12
1 19 461560 21-SEP-12 461562 21-SEP-12
1 20 461562 21-SEP-12 461564 21-SEP-12
1 21 461564 21-SEP-12 461566 21-SEP-12
1 22 461566 21-SEP-12 461568 21-SEP-12
1 23 461568 21-SEP-12 461571 21-SEP-12
1 24 461571 21-SEP-12 461573 21-SEP-12
1 25 461573 21-SEP-12 461575 21-SEP-12
1 26 461575 21-SEP-12 461577 21-SEP-12
1 27 461577 21-SEP-12 461604 21-SEP-12
1 28 461604 21-SEP-12 461606 21-SEP-12
1 29 461606 21-SEP-12 461609 21-SEP-12
1 30 461609 21-SEP-12 461611 21-SEP-12
1 31 461611 21-SEP-12 461711 21-SEP-12
Media recovery start SCN is 444419
Recovery must be done beyond SCN 444419 to clear data files fuzziness
Finished restore at 21-SEP-12
RMAN> exit
n) Query the recorded names of datafiles, tempfiles and online logfiles from the restored controlfile. Record it. We'll use them to remap to its new location.
[GELLEE3 /home/oracle]$ sqlplus '/as sysdba'

Code: Select all

set pages 999
set lines 350
COLUMN NAME FORMAT a80
COLUMN MEMBER FORMAT a80
SPOOL db_filenames.out
SELECT FILE# AS "File/Grp#", NAME FROM V$DATAFILE;
SELECT GROUP#,MEMBER FROM V$LOGFILE;
select name from v$tempfile;
SPOOL OFF
SQL> set pages 999
set lines 350
COLUMN NAME FORMAT a80
COLUMN MEMBER FORMAT a80
SPOOL db_filenames.out
SELECT FILE# AS "File/Grp#", NAME FROM V$DATAFILE;
SELECT GROUP#,MEMBER FROM V$LOGFILE;
select name from v$tempfile;
SPOOL OFF
SQL> SQL> SQL> SQL> SQL>
File/Grp# NAME
---------- --------------------------------------------------------------------------------
1 +VOL1/gellee/datafile/system.438.794355759
2 +VOL1/gellee/datafile/undotbs1.436.794355763
3 +VOL1/gellee/datafile/sysaux.437.794355761
4 +VOL1/gellee/datafile/users.435.794355763

SQL>
GROUP# MEMBER
---------- --------------------------------------------------------------------------------
3 +VOL1/gellee/onlinelog/group_3.431.794355929
3 +FRA/gellee/onlinelog/group_3.280.794355939
2 +VOL1/gellee/onlinelog/group_2.432.794355913
2 +FRA/gellee/onlinelog/group_2.279.794355925
1 +VOL1/gellee/onlinelog/group_1.433.794355903
1 +FRA/gellee/onlinelog/group_1.278.794355907

6 rows selected.

SQL>
NAME
--------------------------------------------------------------------------------
+VOL1/gellee/tempfile/temp.430.794355961
SQL> exit
o) Create an RMAN restore script and fire it in RMAN prompt and via shell script.
[GELLEE3 /home/oracle]$ vi restore.rmn

Below is the created RMAN script:

Code: Select all

RUN
{
  # allocate a channel to the tape device
  ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
  ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
  ALLOCATE CHANNEL ch02 TYPE 'SBT_TAPE';
  # Set correct NB_ORA_SERV and NB_ORA_CLIENT. Contact NBU Team.
  SEND 'NB_ORA_SERV=[media_server], NB_ORA_CLIENT=[source_db_client]';

  # rename the datafiles
  SET NEWNAME FOR DATAFILE 1 TO '/u02/oradata/GELLEE3/system.dbf';
  SET NEWNAME FOR DATAFILE 2 TO '/u02/oradata/GELLEE3/undotbs1.dbf';
  SET NEWNAME FOR DATAFILE 3 TO '/u02/oradata/GELLEE3/sysaux.dbf';
  SET NEWNAME FOR DATAFILE 4 TO '/u02/oradata/GELLEE3/users.dbf';
  
  #rename temp files
  SQL "ALTER DATABASE RENAME FILE ''+VOL1/gellee/tempfile/temp.430.794355961''
      TO ''/u02/oradata/GELLEE3/temp.dbf'' ";
  
  # rename  online redo logs
  SQL "ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_3.280.794355939''
      TO ''/u02/oradata/GELLEE3/onlinelog/group_3.280.794355939'' ";
  SQL "ALTER DATABASE RENAME FILE ''+VOL1/gellee/onlinelog/group_2.432.794355913''
      TO ''/u02/oradata/GELLEE3/onlinelog/group_2.432.794355913'' ";
  SQL "ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_2.279.794355925''
      TO ''/u02/oradata/GELLEE3/onlinelog/group_2.279.794355925'' ";
  SQL "ALTER DATABASE RENAME FILE ''+VOL1/gellee/onlinelog/group_1.433.794355903''
      TO ''/u02/oradata/GELLEE3/onlinelog/group_1.433.794355903'' ";
  SQL "ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_1.278.794355907''
      TO ''/u02/oradata/GELLEE3/onlinelog/group_1.278.794355907'' ";

  # Do a SET UNTIL to the latest Low SCN of Archived Logs to prevent recovery of the online logs
  # To determine the Next SCN: RMAN> list backup of archivelog all;
  SET UNTIL SCN 461711;
  # restore the database and switch the datafile names
  RESTORE DATABASE;
  SWITCH DATAFILE ALL;

  # recover the database
  RECOVER DATABASE;
}
p) Connect to RMAN target without connecting to recovery catalog and begin database restore.
[GELLEE3 /home/oracle]$ rman target / catalog rman11g/rmanpwd11g@CAT11g cmdfile=restore.rmn
[GELLEE3 /u01/app/oracle/product/10.2.0/db_1/dbs]$ rman target / nocatalog cmdfile=restore.rmn

Recovery Manager: Release 10.2.0.5.0 - Production on Fri Sep 21 11:07:02 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: GELLEE (DBID=830948345, not open)
using target database control file instead of recovery catalog

RMAN> RUN
2> {
3> # allocate a channel to the tape device
4> #ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS='...';
5>
6> # rename the datafiles
7> SET NEWNAME FOR DATAFILE 1 TO '/u02/oradata/GELLEE3/system.dbf';
8> SET NEWNAME FOR DATAFILE 2 TO '/u02/oradata/GELLEE3/undotbs1.dbf';
9> SET NEWNAME FOR DATAFILE 3 TO '/u02/oradata/GELLEE3/sysaux.dbf';
10> SET NEWNAME FOR DATAFILE 4 TO '/u02/oradata/GELLEE3/users.dbf';
11>
12> #rename temp files
13> SQL "ALTER DATABASE RENAME FILE ''+VOL1/gellee/tempfile/temp.430.794355961''
14> TO ''/u02/oradata/GELLEE3/temp.dbf'' ";
15>
16> # rename online redo logs
17> SQL "ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_3.280.794355939''
18> TO ''/u02/oradata/GELLEE3/onlinelog/group_3.280.794355939'' ";
19> SQL "ALTER DATABASE RENAME FILE ''+VOL1/gellee/onlinelog/group_2.432.794355913''
20> TO ''/u02/oradata/GELLEE3/onlinelog/group_2.432.794355913'' ";
21> SQL "ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_2.279.794355925''
22> TO ''/u02/oradata/GELLEE3/onlinelog/group_2.279.794355925'' ";
23> SQL "ALTER DATABASE RENAME FILE ''+VOL1/gellee/onlinelog/group_1.433.794355903''
24> TO ''/u02/oradata/GELLEE3/onlinelog/group_1.433.794355903'' ";
25> SQL "ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_1.278.794355907''
26> TO ''/u02/oradata/GELLEE3/onlinelog/group_1.278.794355907'' ";
27>
28> # Do a SET UNTIL to the highest Next SCN of Archived Logs to prevent recovery of the online logs
29> # To determine the Next SCN: RMAN> list backup of archivelog all;
30> SET UNTIL SCN 468811;
31> # restore the database and switch the datafile names
32> RESTORE DATABASE;
33> SWITCH DATAFILE ALL;
34>
35> # recover the database
36> RECOVER DATABASE;
37> }
38>
39>
executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

sql statement: ALTER DATABASE RENAME FILE ''+VOL1/gellee/tempfile/temp.430.794355961''TO ''/u02/oradata/GELLEE3/temp.dbf''

sql statement: ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_3.280.794355939''TO ''/u02/oradata/GELLEE3/onlinelog/group_3.280.794355939''

sql statement: ALTER DATABASE RENAME FILE ''+VOL1/gellee/onlinelog/group_2.432.794355913''TO ''/u02/oradata/GELLEE3/onlinelog/group_2.432.794355913''

sql statement: ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_2.279.794355925''TO ''/u02/oradata/GELLEE3/onlinelog/group_2.279.794355925''

sql statement: ALTER DATABASE RENAME FILE ''+VOL1/gellee/onlinelog/group_1.433.794355903''TO ''/u02/oradata/GELLEE3/onlinelog/group_1.433.794355903''

sql statement: ALTER DATABASE RENAME FILE ''+FRA/gellee/onlinelog/group_1.278.794355907''TO ''/u02/oradata/GELLEE3/onlinelog/group_1.278.794355907''

executing command: SET until clause

Starting restore at 21-SEP-12
Starting implicit crosscheck backup at 21-SEP-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK
Crosschecked 7 objects
Finished implicit crosscheck backup at 21-SEP-12

Starting implicit crosscheck copy at 21-SEP-12
using channel ORA_DISK_1
Finished implicit crosscheck copy at 21-SEP-12

searching for all files in the recovery area
cataloging files...
no files cataloged

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 00001 to /u02/oradata/GELLEE3/system.dbf
restoring datafile 00002 to /u02/oradata/GELLEE3/undotbs1.dbf
restoring datafile 00003 to /u02/oradata/GELLEE3/sysaux.dbf
restoring datafile 00004 to /u02/oradata/GELLEE3/users.dbf
channel ORA_DISK_1: reading from backup piece /u03/backup/GELLEE_17_794571713
channel ORA_DISK_1: restored backup piece 1
piece handle=/u03/backup/GELLEE_17_794571713 tag=TAG20120921T102152
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 21-SEP-12

datafile 1 switched to datafile copy
input datafile copy recid=5 stamp=794574491 filename=/u02/oradata/GELLEE3/system.dbf
datafile 2 switched to datafile copy
input datafile copy recid=6 stamp=794574491 filename=/u02/oradata/GELLEE3/undotbs1.dbf
datafile 3 switched to datafile copy
input datafile copy recid=7 stamp=794574491 filename=/u02/oradata/GELLEE3/sysaux.dbf
datafile 4 switched to datafile copy
input datafile copy recid=8 stamp=794574491 filename=/u02/oradata/GELLEE3/users.dbf

Starting recover at 21-SEP-12
using channel ORA_DISK_1

starting media recovery

archive log filename=/u02/oradata/1_62_794355901.arc thread=1 sequence=62
archive log filename=/u02/oradata/1_63_794355901.arc thread=1 sequence=63
archive log filename=/u02/oradata/1_64_794355901.arc thread=1 sequence=64
archive log filename=/u02/oradata/1_65_794355901.arc thread=1 sequence=65
archive log filename=/u02/oradata/1_66_794355901.arc thread=1 sequence=66
archive log filename=/u02/oradata/1_67_794355901.arc thread=1 sequence=67
archive log filename=/u02/oradata/1_68_794355901.arc thread=1 sequence=68
archive log filename=/u02/oradata/1_69_794355901.arc thread=1 sequence=69
archive log filename=/u02/oradata/1_70_794355901.arc thread=1 sequence=70
archive log filename=/u02/oradata/1_71_794355901.arc thread=1 sequence=71
archive log filename=/u02/oradata/1_72_794355901.arc thread=1 sequence=72
archive log filename=/u02/oradata/1_73_794355901.arc thread=1 sequence=73
archive log filename=/u02/oradata/1_74_794355901.arc thread=1 sequence=74
archive log filename=/u02/oradata/1_75_794355901.arc thread=1 sequence=75
archive log filename=/u02/oradata/1_76_794355901.arc thread=1 sequence=76
archive log filename=/u02/oradata/1_77_794355901.arc thread=1 sequence=77
archive log filename=/u02/oradata/1_78_794355901.arc thread=1 sequence=78
archive log filename=/u02/oradata/1_79_794355901.arc thread=1 sequence=79
archive log filename=/u02/oradata/1_80_794355901.arc thread=1 sequence=80
archive log filename=/u02/oradata/1_81_794355901.arc thread=1 sequence=81
archive log filename=/u02/oradata/1_82_794355901.arc thread=1 sequence=82
media recovery complete, elapsed time: 00:00:03
Finished recover at 21-SEP-12

Recovery Manager complete.
q) Open the database with RESETLOGS option.
WARNING! At this point, DO NOT connect to recovery catalog database so it won't be messed up!
[GELLEE3 /home/oracle]$ rman target / nocatalog

RMAN> alter database open RESETLOGS;
RMAN> alter database open RESETLOGS;

Database altered.
6.) Rename database:
a) Cleanly restart database in MOUNT mode.
SQL> shutdown immediate;
SQL> startup mount;
b) Use DBNEWID to rename database.
[GELLEE3 /home/oracle]$ nid TARGET=sys/passwordDBNAME=[NEWDBNAME]
[GELLEE3 /home/oracle]$ nid TARGET=sys/oracle DBNAME=GELLEE3
[GELLEE3 /home/oracle]$ nid TARGET=sys/oracle DBNAME=GELLEE3

DBNEWID: Release 10.2.0.5.0 - Production on Fri Sep 21 11:16:57 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to database GELLEE (DBID=830948345)

Connected to server version 10.2.0

Control Files in database:
/u02/oradata/GELLEE3/controlfile/control01.ctl

Change database ID and database name GELLEE to GELLEE3? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 830948345 to 1968805481
Changing database name from GELLEE to GELLEE3
Control File /u02/oradata/GELLEE3/controlfile/control01.ctl - modified
Datafile /u02/oradata/GELLEE3/system.dbf - dbid changed, wrote new name
Datafile /u02/oradata/GELLEE3/undotbs1.dbf - dbid changed, wrote new name
Datafile /u02/oradata/GELLEE3/sysaux.dbf - dbid changed, wrote new name
Datafile /u02/oradata/GELLEE3/users.dbf - dbid changed, wrote new name
Datafile /u02/oradata/GELLEE3/temp.dbf - dbid changed, wrote new name
Control File /u02/oradata/GELLEE3/controlfile/control01.ctl - dbid changed, wrote new name
Instance shut down

Database name changed to GELLEE3.
Modify parameter file and generate a new password file before restarting.
Database ID for database GELLEE3 changed to 1968805481.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
c) Modify the parameter file to reflect the new db_name.
[GELLEE3 /home/oracle]$ cd $ORACLE_HOME/dbs
SQL> create pfile from spfile;
[GELLEE3 /u01/app/oracle/product/10.2.0/db_1/dbs]$ vi initGELLEE3.ora
Edit *.db_name='GELLEE' to *.db_name='GELLEE3'

d) Recreate spfile
SQL> create spfile from pfile;

e) Startup in mount mode.
SQL> startup mount;
SQL> startup mount;
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1272600 bytes
Variable Size 62915816 bytes
Database Buffers 100663296 bytes
Redo Buffers 2920448 bytes
Database mounted.

f. And finally, open the database with RESETLOGS option.
SQL> alter database open RESETLOGS;
SQL> alter database open RESETLOGS;

Database altered.

SQL>
-- WE're DONE!
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: RESTORE and RECOVER an Oracle Database to a New Host With a New Database Name

Post by xaeresis »

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: RESTORE and RECOVER an Oracle Database to a New Host With a New Database Name

Post by xaeresis »

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: RESTORE and RECOVER an Oracle Database to a New Host With a New Database Name

Post by xaeresis »

xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: RESTORE and RECOVER an Oracle Database to a New Host With a New Database Name

Post by xaeresis »

Post Reply