First view the current name of the database
using the following command:-
sys>>select name from v$database;
Take a backup of the control file:-
sys>>alter database backup controlfile to trace;
sys>>shut immediate
Re-write the new name of the database in init<SID>.ora file:-
oracle@localhost ~]cd $ORACLE_HOME/dbs
oracle@localhost dbs]vi $init$ORACLE_SID.ora
dbname=<newdb>
:wq
Edit the latest trace file and copy it as <controlfile>.sql:-
oracle@localhost ~]cd /disk1/oradata/diag/rdbms/ORCL/trace
oracle@localhost trace]ls -ltr
oracle@localhost trace]cp <last .trc file> control.sql
oracle@localhost ~]vi control.ctl
<###delete all the lines till###>
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE <newdb> RESETLOGS ARCHIVELOG
.
.
.
.
.
CHARACTER SET US7ASCII;
<###delete all the line below###>
oracle@localhost ~]sqlplus / as sysdba
Run that edited <controlfile>.sql:-
sys>>@control.sql
controlfile created.
sys>>alter database open resetlogs;
Now check the name of the database:-
sys>>select name from v$database;
Good Work Sanat
ReplyDelete