MANUAL RENAMING THE DATABASE
[oracle@demo ~]$ export ORACLE_SID=testdb
[oracle@demo ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 19
08:57:42 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
Production
With the Partitioning, OLAP, Data Mining and Real
Application Testing options
SQL> select name from v$database;
NAME
---------
TESTDB
SQL> show parameter dump
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/oracle/diag/rdbms/tes
tdb/testdb/trace
core_dump_dest string /u01/app/oracle/diag/rdbms/tes
tdb/testdb/cdump
max_dump_file_size string unlimited
shadow_core_dump string partial
user_dump_dest string /u01/app/oracle/diag/rdbms/tes
tdb/testdb/trace
SQL>
SQL> alter database backup controlfile to trace;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition
Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real
Application Testing options
[oracle@demo ~]$
[oracle@demo ~]$ cd
/u01/app/oracle/diag/rdbms/testdb/testdb/trace
[oracle@demo trace]$ls -ltr
(pick up the last trace file)
[oracle@demo trace]$ cp testdb_ora_5776.trc ~/control.sql
[oracle@demo trace]$vi control.sql
-->d+g+g
startup nomount
create controlfile set database
"TEST"............................
characterset US7SCII
;
->d+G
:wq
[oracle@demo ~]$ cat control.sql
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1
'/u01/testdb/redo1.log' SIZE 10M
BLOCKSIZE 512,
GROUP 2
'/u01/testdb/redo2.log' SIZE 10M
BLOCKSIZE 512,
GROUP 3
'/u01/testdb/redo3.log' SIZE 10M
BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/testdb/system.dbf',
'/u01/testdb/sysaux.dbf',
'/u01/testdb/undo1.dbf'
CHARACTER SET AL32UTF8
;
[oracle@demo ~]$
SQL> SELECT NAME,STATUS FROM V_$CONTROLFILE;
NAME
--------------------------------------------------------------------------------
STATUS
-------
/u01/app/oracle/testdb/control01.ctl
/u01/app/oracle/fast_recovery_area/testdb/control02.ctl
SQL> SHUT IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@demo ~]$ cd /u01/app/oracle/testdb/
[oracle@demo testdb]$ ls
control01.ctl
[oracle@demo testdb]$ mkdir backup
[oracle@demo testdb]$ cp *.ctl backup
[oracle@demo testdb]$ rm *.ctl
[oracle@demo testdb]$ ls
backup
[oracle@demo testdb]$ cd backup/
[oracle@demo backup]$ ls
control01.ctl
[oracle@demo backup]$ cd ..
[oracle@demo testdb]$ cd ..
[oracle@demo oracle]$ cd fast_recovery_area/testdb/
[oracle@demo testdb]$ ls
control02.ctl
[oracle@demo testdb]$ mkdir backup
[oracle@demo testdb]$ cp *.ctl backup
[oracle@demo testdb]$ ls
backup control02.ctl
[oracle@demo testdb]$ rm *.ctl
[oracle@demo testdb]$ ls
backup
SQL> startup nomount;
ORACLE instance started.
Total System Global Area
171581440 bytes
Fixed Size
1343668 bytes
Variable Size
117444428 bytes
Database Buffers
50331648 bytes
Redo Buffers
2461696 bytes
SQL> @ control.sql
ORA-01081: cannot start already-running ORACLE - shut it
down first
CREATE CONTROLFILE SET DATABASE "TEST"
NORESETLOGS ARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-01223: RESETLOGS must be specified to set a new database
name
SQL> @ control.sql
ORA-01081: cannot start already-running ORACLE - shut it
down first
Control file created.
SQL> alter database open resetlogs;
Database altered.
SQL> select name from v$database;
NAME
---------
TEST