===== Den Namen und die SID einer Oracle Datenbank ändern=====
** ab 10g? – Test mit 12c 2015/07**
Aufgabe: Der Name und auch die SID einer 12c Datenbank soll vom „emrep“ auf „pmrep“ geändert werden.
Ablauf:
* Die Datenbank stoppen
* Die Instance im mount Modus starten
* Mit dem nid Werkzeug die DB umbenennen
* init.ora aus dem spfile erstellen und neue Instance damit starten
* Neuen spfile anlegen
* Umgebungsskripte / Backup Skripte je nach Bedarf anpassen
* Datenbank Password Datei neu erzeugen
* Die /etc/oratab Datei auf die neue SID anpassen
----
===DB stoppen===
sqlplus / as sysdba
shutdown immediate
exit
===DB im Mount Modus starten===
sqlplus / as sysdba
startup mount
=== Mit dem nid Tool die Datenbank umbenennen===
Run nid:
nid target="/ as sysdba" dbname=pmrep setname=YES
DBNEWID: Release 12.1.0.2.0 - Production on Sat Jul 4 00:12:04 2015
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database EMREP (DBID=4080621756)
Connected to server version 12.1.0
Control Files in database:
/opt/oracle/oradata/EMREP/controlfile/o1_mf_b0pk0vy5_.ctl
/opt/oracle/fast_recovery_area/EMREP/controlfile/o1_mf_b0pk0w05_.ctl
Change database name of database EMREP to PMREP? (Y/[N]) => Y
Proceeding with operation
Changing database name from EMREP to PMREP
Control File /opt/oracle/oradata/EMREP/controlfile/o1_mf_b0pk0vy5_.ctl - modified
Control File /opt/oracle/fast_recovery_area/EMREP/controlfile/o1_mf_b0pk0w05_.ctl - modified
Datafile /opt/oracle/oradata/EMREP/datafile/o1_mf_system_b0pjxzfb_.db - wrote new name
Datafile /opt/oracle/oradata/EMREP/datafile/o1_mf_sysaux_b0pjwl9c_.db - wrote new name
Datafile /opt/oracle/oradata/EMREP/datafile/o1_mf_undotbs1_b0pk01oq_.db - wrote new name
Datafile /opt/oracle/oradata/EMREP/datafile/o1_mf_users_b0pk00lv_.db - wrote new name
Datafile /opt/oracle/oradata/EMREP/datafile/o1_mf_temp_b0pk10tv_.tm - wrote new name
Control File /opt/oracle/oradata/EMREP/controlfile/o1_mf_b0pk0vy5_.ctl - wrote new name
Control File /opt/oracle/fast_recovery_area/EMREP/controlfile/o1_mf_b0pk0w05_.ctl - wrote new name
Instance shut down
Database name changed to PMREP.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.
===init.ora anpassen===
sqlplus / as sysdba
create pfile='$ORACLE_HOME/dbs/initPMREP.ora' from spfile='$ORACLE_HOME/dbs/spfileEMREP.ora';
exit
#Edit init.ora
#remove all EMREP__ Parameter
set the *.db_name to 'PMREP'
vi $ORACLE_HOME/dbs/initPMREP.ora
*.db_name='PMREP'
#change SID
export ORACLE_SID=PMREP
sqlplus / as sysdba
startup
create spfile from pfile;
#restart with spfile
startup force
=== Skripte anpassen===
Je nach Bedarf die Umgebungsskripte auf die neue SID anpassen
===DBS Verzeichnis aufräumen===
cd $ORACLE_HOME/dbs
rm *EMREP*
===Password File erzeugen===
$ orapwd file=$ORACLE_HOME/dbs/orapwPMREP password=oracle entries=10
===Oratab anpassen===
vi /etc/oratab
----
====Quellen ====
* http://msutic.blogspot.de/2013/04/change-sid-of-oracle-database-using.html