Archive for March, 2012


Start the database with pfile

Take the backup of existing initialization Parameter file(pfile)

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             268436688 bytes
Database Buffers          134217728 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> sho parameter pfile;

NAME                                 TYPE        VALUE
———————————— ———– ——————————
spfile                               string

SQL> select dbid,name from v$database;

DBID NAME
———- ———
2076663514 TEST

SQL>!

[oracle@localhost ~]$ nid target=sys DBNAME=varun SETNAME=y

DBNEWID: Release 11.2.0.2.0 – Production on Thu Mar 22 17:56:48 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Password:
Connected to database TEST (DBID=2076663514)

Connected to server version 11.2.0

Control Files in database:
/varun/oraclehome/oraclebase/varun/control01.ctl
/varun/oraclehome/oraclebase/fast_recovery_area/varun/control02.ctl

Change database name of database TEST to VARUN? (Y/[N]) => Y

Proceeding with operation
Changing database name from TEST to VARUN
Control File /varun/oraclehome/oraclebase/varun/control01.ctl – modified
Control File /varun/oraclehome/oraclebase/fast_recovery_area/varun/control02.ctl – modified
Datafile /varun/oraclehome/oraclebase/varun/system01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/sysaux01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/undotbs01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/users01.db – wrote new name
Datafile /varun/oraclehome/oraclebase/varun/temp01.db – wrote new name
Control File /varun/oraclehome/oraclebase/varun/control01.ctl – wrote new name
Control File /varun/oraclehome/oraclebase/fast_recovery_area/varun/control02.ctl – wrote new name
Instance shut down

Database name changed to VARUN.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID – Completed succesfully.

  • Set the DB_NAME initialization parameter in the initialization parameter file to the new database name
  • Change the ORACLE_ SID  which was set in environment variables
  • change the old initialization  parameter file to newly changed

SQL> startup
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
Database opened.
SQL> select name,dbid from v$database;

NAME            DBID
——— ———-
VARUN     2076663514

 

Start the database with pfile

Take the backup of existing initialization Parameter file(pfile)

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> !
[oracle@localhost ~]$  nid TARGET=sys/sys@psdmo9 DBNAME=varun

DBNEWID: Release 11.2.0.2.0 – Production on Thu Mar 15 21:25:08 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to database PSDMO9 (DBID=1666743069)

Connected to server version 11.2.0

Control Files in database:
/varun/oraclehome/oraclebase/psdmo9/control01.ctl
/varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl

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

Proceeding with operation
Changing database ID from 1666743069 to 2761382452
Changing database name from PSDMO9 to VARUN
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – modified
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – modified
Datafile /varun/oraclehome/oraclebase/psdmo9/system01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/sysaux01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/undotbs01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/users01.db – dbid changed, wrote new name
Datafile /varun/oraclehome/oraclebase/psdmo9/temp01.db – dbid changed, wrote new name
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – dbid changed, wrote new name
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – dbid changed, wrote new name
Instance shut down

Database name changed to VARUN.
Modify parameter file and generate a new password file before restarting.
Database ID for database VARUN changed to 2761382452.
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.


  • Set the DB_NAME initialization parameter in the initialization parameter file to the new database name
  • Change the ORACLE_ SID  which was set in environment variables
  • change the old initialization  parameter file to newly changed

EX: mv /varun/oraclehome/oraclebase/home/dbs/initpsdmo9.ora  /varun/oraclehome/oraclebase/home/dbs/initVARUN.ora

[oracle@localhost dbs]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 15 21:29:10 2012

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL> select name from v$database;

NAME
———
VARUN

[oracle@localhost ~]$ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 15 20:44:52 2012

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.

SQL> !

[oracle@localhost ~]$ nid target = sys

DBNEWID: Release 11.2.0.2.0 – Production on Thu Mar 15 20:49:20 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Password:
Connected to database PSDMO9 (DBID=1666710808)

Connected to server version 11.2.0

Control Files in database:
/varun/oraclehome/oraclebase/psdmo9/control01.ctl
/varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl

Change database ID of database PSDMO9? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 1666710808 to 1666743069
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – modified
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – modified
Datafile /varun/oraclehome/oraclebase/psdmo9/system01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/sysaux01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/undotbs01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/users01.db – dbid changed
Datafile /varun/oraclehome/oraclebase/psdmo9/temp01.db – dbid changed
Control File /varun/oraclehome/oraclebase/psdmo9/control01.ctl – dbid changed
Control File /varun/oraclehome/oraclebase/fast_recovery_area/psdmo9/control02.ctl – dbid changed
Instance shut down

Database ID for database PSDMO9 changed to 1666743069.
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 ID.
DBNEWID – Completed succesfully.

SQL> startup mount
ORACLE instance started.

Total System Global Area  409194496 bytes
Fixed Size                  2226992 bytes
Variable Size             281019600 bytes
Database Buffers          121634816 bytes
Redo Buffers                4313088 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL>  select dbid from v$database;
DBID
———-
1666743069