SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- ---------- ----------------
Source MOUNTED PRIMARY
SQL> set lines 300 pages 50000
SQL> col member for a40
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ---------------------------------------- ---
4 ONLINE /data/oracle/Source/r01/redo04_1.log NO
4 ONLINE /data/oracle/Source/r02/redo04_2.log NO
2 rows selected.
SQL> alter database rename file '/data/oracle/Source/r01/redo04_1.log' TO '/data/oracle/Target/r01/redo04_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo04_2.log' TO '/data/oracle/Target/r02/redo04_2.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r01/redo03_1.log' TO '/data/oracle/Target/r01/redo03_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo03_2.log' TO '/data/oracle/Target/r02/redo03_2.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r01/redo02_1.log' TO '/data/oracle/Target/r01/redo02_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo02_2.log' TO '/data/oracle/Target/r02/redo02_2.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r01/redo01_1.log' TO '/data/oracle/Target/r01/redo01_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo01_2.log' TO '/data/oracle/Target/r02/redo01_2.log';
Database altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ---------------------------------------- ---
4 ONLINE /data/oracle/Target/r01/redo04_1.log NO
4 ONLINE /data/oracle/Target/r02/redo04_2.log NO
3 ONLINE /data/oracle/Target/r01/redo03_1.log NO
3 ONLINE /data/oracle/Target/r02/redo03_2.log NO
2 ONLINE /data/oracle/Target/r01/redo02_1.log NO
2 ONLINE /data/oracle/Target/r02/redo02_2.log NO
1 ONLINE /data/oracle/Target/r01/redo01_1.log NO
1 ONLINE /data/oracle/Target/r02/redo01_2.log NO
8 rows selected.
SQL> alter database open resetlogs;
Database altered.
SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- ---------- ----------------
Source READ WRITE PRIMARY
SQL> col FILE_NAME for a40
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME from dba_temp_files;
FILE_NAME FILE_ID TABLESPACE_NAME
---------------------------------------- ---------- ------------------------------
/data/oracle/Source/u01/temp01.dbf 1 TEMP
/data/oracle/Source/u01/temp02.dbf 2 TEMP
/data/oracle/Source/u01/temp03.dbf 3 TEMP
/data/oracle/Source/u01/temp04.dbf 4 TEMP
/data/oracle/Source/u01/temp05.dbf 5 TEMP
/data/oracle/Source/u01/temp06.dbf 6 TEMP
/data/oracle/Source/u01/temp07.dbf 7 TEMP
/data/oracle/Source/u01/temp08.dbf 8 TEMP
8 rows selected.
SQL> create temporary tablespace TEMP1 tempfile '/data/oracle/Target_NEW/u02/temp101.dbf' size 2g;
Tablespace created.
SQL> alter database default temporary tablespace TEMP1;
Database altered.
SQL> DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;
Tablespace dropped.
SQL> col FILE_NAME for a50
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME from dba_temp_files;
FILE_NAME FILE_ID TABLESPACE_NAME
-------------------------------------------------- ---------- ------------------------------
/data/oracle/Target_NEW/u02/temp101.dbf 9 TEMP1
SQL> alter database backup controlfile to trace as '/db_dumps/oracle/shared01/QLNCMGT0_LE/RMAN/RITM0070950/Jan18/newcontrol.sql';
Database altered.
SQL> shutdown immediate;
SQL>
SQL> !ps -ef | grep pmon
oracle 13849 10738 0 07:06:07 pts/11 0:00 grep pmon
oracle 24749 1 0 Nov 01 ? 267:28 ora_pmon_Running Oracle SID's(details)
oracle 8946 1 0 Nov 01 ? 352:52 ora_pmon_Running Oracle SID's(details)
oracle 9079 1 0 Nov 01 ? 286:40 ora_pmon_Running Oracle SID's(details)
oracle 4795 1 0 16:07:59 ? 1:32 ora_pmon_Running Oracle SID's(details)
oracle 26593 1 0 Nov 01 ? 281:51 ora_pmon_Running Oracle SID's(details)
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string Source
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string Source
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2057520 bytes
Variable Size 713038544 bytes
Database Buffers 348127232 bytes
Redo Buffers 10518528 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ Serverx:Target:/data/oracle/Target_NEW/u02 >echo $ORACLE_SID
Target
$ Serverx:Target:/data/oracle/Target_NEW/u02 >nid target=/ dbname=Target
DBNEWID: Release 10.2.0.5.0 - Production on Thu Jan 29 07:08:46 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to database Source (DBID=x)
Connected to server version 10.2.0
Control Files in database:
/data/oracle/Target/u01/control01.ctl
/data/oracle/Target/u01/control02.ctl
/data/oracle/Target/u01/control03.ctl
Change database ID and database name Source to Target? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1720920130 to 3437567296
Changing database name from Source to Target
Control File /data/oracle/Target/u01/control01.ctl - modified
Control File /data/oracle/Target/u01/control02.ctl - modified
Control File /data/oracle/Target/u01/control03.ctl - modified
Datafile /data/oracle/Target/u01/system01.dbf - dbid changed, wrote new name
Datafile /data/oracle/Target/u01/undotbs01.dbf - dbid changed, wrote new name
Datafile /data/oracle/Target/u01/sysaux01.dbf - dbid changed, wrote new name
Datafile /data/oracle/Target/u01/users01.dbf - dbid changed, wrote new name
xxx datafiles
Instance shut down
Database name changed to Target.
Modify parameter file and generate a new password file before restarting.
Database ID for database Target changed to 3437567296.
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.
$ Serverx:Target:/data/oracle/Target_NEW/u02 >cd $ORACLE_HOME
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5 >cd dbs
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >ls -ltr
-rw-rw---- 1 oracle dba 24 Jan 11 2012 lkTarget
-rw-r--r-- 1 oracle dba 720846 Jan 11 2012 patch.log
-rw-r----- 1 oracle dba 2048 Jan 8 05:58 orapwTarget
-rw-r--r-- 1 oracle dba 1666 Jan 28 15:40 initTarget.ora_org
-rw-r----- 1 oracle dba 2048 Jan 28 15:40 orapwTarget_org
-rw-r----- 1 oracle dba 4608 Jan 28 15:40 spfileTarget.ora_org
-rw-r--r-- 1 oracle dba 1727 Jan 28 16:02 initTarget.ora
-rw-rw---- 1 oracle dba 24 Jan 28 16:10 lkSource
-rw-r----- 1 oracle dba 11649024 Jan 29 07:01 snapcf_Target.f
-rw-rw---- 1 oracle dba 1544 Jan 29 07:08 hc_Target.dat
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >ls -ltr init*
-rw-r--r-- 1 oracle dba 1666 Jan 28 15:40 initTarget.ora_org
-rw-r--r-- 1 oracle dba 1727 Jan 28 16:02 initTarget.ora
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >vi initTarget.ora
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 29 07:10:18 2015
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2057520 bytes
Variable Size 713038544 bytes
Database Buffers 348127232 bytes
Redo Buffers 10518528 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- ---------- ----------------
Target READ WRITE PRIMARY
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string Target
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string Target
NAME OPEN_MODE DATABASE_ROLE
--------- ---------- ----------------
Source MOUNTED PRIMARY
SQL> set lines 300 pages 50000
SQL> col member for a40
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ---------------------------------------- ---
4 ONLINE /data/oracle/Source/r01/redo04_1.log NO
4 ONLINE /data/oracle/Source/r02/redo04_2.log NO
2 rows selected.
SQL> alter database rename file '/data/oracle/Source/r01/redo04_1.log' TO '/data/oracle/Target/r01/redo04_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo04_2.log' TO '/data/oracle/Target/r02/redo04_2.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r01/redo03_1.log' TO '/data/oracle/Target/r01/redo03_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo03_2.log' TO '/data/oracle/Target/r02/redo03_2.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r01/redo02_1.log' TO '/data/oracle/Target/r01/redo02_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo02_2.log' TO '/data/oracle/Target/r02/redo02_2.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r01/redo01_1.log' TO '/data/oracle/Target/r01/redo01_1.log';
Database altered.
SQL> alter database rename file '/data/oracle/Source/r02/redo01_2.log' TO '/data/oracle/Target/r02/redo01_2.log';
Database altered.
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ---------------------------------------- ---
4 ONLINE /data/oracle/Target/r01/redo04_1.log NO
4 ONLINE /data/oracle/Target/r02/redo04_2.log NO
3 ONLINE /data/oracle/Target/r01/redo03_1.log NO
3 ONLINE /data/oracle/Target/r02/redo03_2.log NO
2 ONLINE /data/oracle/Target/r01/redo02_1.log NO
2 ONLINE /data/oracle/Target/r02/redo02_2.log NO
1 ONLINE /data/oracle/Target/r01/redo01_1.log NO
1 ONLINE /data/oracle/Target/r02/redo01_2.log NO
8 rows selected.
SQL> alter database open resetlogs;
Database altered.
SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- ---------- ----------------
Source READ WRITE PRIMARY
SQL> col FILE_NAME for a40
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME from dba_temp_files;
FILE_NAME FILE_ID TABLESPACE_NAME
---------------------------------------- ---------- ------------------------------
/data/oracle/Source/u01/temp01.dbf 1 TEMP
/data/oracle/Source/u01/temp02.dbf 2 TEMP
/data/oracle/Source/u01/temp03.dbf 3 TEMP
/data/oracle/Source/u01/temp04.dbf 4 TEMP
/data/oracle/Source/u01/temp05.dbf 5 TEMP
/data/oracle/Source/u01/temp06.dbf 6 TEMP
/data/oracle/Source/u01/temp07.dbf 7 TEMP
/data/oracle/Source/u01/temp08.dbf 8 TEMP
8 rows selected.
SQL> create temporary tablespace TEMP1 tempfile '/data/oracle/Target_NEW/u02/temp101.dbf' size 2g;
Tablespace created.
SQL> alter database default temporary tablespace TEMP1;
Database altered.
SQL> DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;
Tablespace dropped.
SQL> col FILE_NAME for a50
SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME from dba_temp_files;
FILE_NAME FILE_ID TABLESPACE_NAME
-------------------------------------------------- ---------- ------------------------------
/data/oracle/Target_NEW/u02/temp101.dbf 9 TEMP1
SQL> alter database backup controlfile to trace as '/db_dumps/oracle/shared01/QLNCMGT0_LE/RMAN/RITM0070950/Jan18/newcontrol.sql';
Database altered.
SQL> shutdown immediate;
SQL>
SQL> !ps -ef | grep pmon
oracle 13849 10738 0 07:06:07 pts/11 0:00 grep pmon
oracle 24749 1 0 Nov 01 ? 267:28 ora_pmon_Running Oracle SID's(details)
oracle 8946 1 0 Nov 01 ? 352:52 ora_pmon_Running Oracle SID's(details)
oracle 9079 1 0 Nov 01 ? 286:40 ora_pmon_Running Oracle SID's(details)
oracle 4795 1 0 16:07:59 ? 1:32 ora_pmon_Running Oracle SID's(details)
oracle 26593 1 0 Nov 01 ? 281:51 ora_pmon_Running Oracle SID's(details)
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string Source
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string Source
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2057520 bytes
Variable Size 713038544 bytes
Database Buffers 348127232 bytes
Redo Buffers 10518528 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ Serverx:Target:/data/oracle/Target_NEW/u02 >echo $ORACLE_SID
Target
$ Serverx:Target:/data/oracle/Target_NEW/u02 >nid target=/ dbname=Target
DBNEWID: Release 10.2.0.5.0 - Production on Thu Jan 29 07:08:46 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to database Source (DBID=x)
Connected to server version 10.2.0
Control Files in database:
/data/oracle/Target/u01/control01.ctl
/data/oracle/Target/u01/control02.ctl
/data/oracle/Target/u01/control03.ctl
Change database ID and database name Source to Target? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1720920130 to 3437567296
Changing database name from Source to Target
Control File /data/oracle/Target/u01/control01.ctl - modified
Control File /data/oracle/Target/u01/control02.ctl - modified
Control File /data/oracle/Target/u01/control03.ctl - modified
Datafile /data/oracle/Target/u01/system01.dbf - dbid changed, wrote new name
Datafile /data/oracle/Target/u01/undotbs01.dbf - dbid changed, wrote new name
Datafile /data/oracle/Target/u01/sysaux01.dbf - dbid changed, wrote new name
Datafile /data/oracle/Target/u01/users01.dbf - dbid changed, wrote new name
xxx datafiles
Instance shut down
Database name changed to Target.
Modify parameter file and generate a new password file before restarting.
Database ID for database Target changed to 3437567296.
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.
$ Serverx:Target:/data/oracle/Target_NEW/u02 >cd $ORACLE_HOME
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5 >cd dbs
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >ls -ltr
-rw-rw---- 1 oracle dba 24 Jan 11 2012 lkTarget
-rw-r--r-- 1 oracle dba 720846 Jan 11 2012 patch.log
-rw-r----- 1 oracle dba 2048 Jan 8 05:58 orapwTarget
-rw-r--r-- 1 oracle dba 1666 Jan 28 15:40 initTarget.ora_org
-rw-r----- 1 oracle dba 2048 Jan 28 15:40 orapwTarget_org
-rw-r----- 1 oracle dba 4608 Jan 28 15:40 spfileTarget.ora_org
-rw-r--r-- 1 oracle dba 1727 Jan 28 16:02 initTarget.ora
-rw-rw---- 1 oracle dba 24 Jan 28 16:10 lkSource
-rw-r----- 1 oracle dba 11649024 Jan 29 07:01 snapcf_Target.f
-rw-rw---- 1 oracle dba 1544 Jan 29 07:08 hc_Target.dat
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >ls -ltr init*
-rw-r--r-- 1 oracle dba 1666 Jan 28 15:40 initTarget.ora_org
-rw-r--r-- 1 oracle dba 1727 Jan 28 16:02 initTarget.ora
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >vi initTarget.ora
$ Serverx:Target:/app/oracle/Target/product/10.2.0.5/dbs >sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 29 07:10:18 2015
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2057520 bytes
Variable Size 713038544 bytes
Database Buffers 348127232 bytes
Redo Buffers 10518528 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select name,open_mode,database_role from v$database;
NAME OPEN_MODE DATABASE_ROLE
--------- ---------- ----------------
Target READ WRITE PRIMARY
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string Target
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string Target
No comments:
Post a Comment