Database Rename Procedure

554 views
440 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
554
On SlideShare
0
From Embeds
0
Number of Embeds
33
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Database Rename Procedure

  1. 1. Anar Godjaev http://anargodjaev.wordpress.com/ DATABASE RENAME PROCEDURE 1- Change INIT.ORA FILE >cd $ORACLE_HOME/dbs >vi init[Dbname].ora >vi initAZDB3.ora AZDB3.__db_cache_size=1157627904 AZDB3.__java_pool_size=33554432 AZDB3.__large_pool_size=16777216 AZDB3.__shared_pool_size=385875968 *.background_dump_dest='/data03/oradata/AZDB3/bdump' *.compatible='10.1.0.5.0' *.control_files='/data03/oradata/AZDB3/control01.ctl','/data03/oradata/AZDB3/control02.ctl','/d ata03/oradata/AZDB3/control0 3.ctl' *.core_dump_dest='/data03/oradata/AZDB3/cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name='AZDB3' *.dispatchers='(PROTOCOL=TCP) (SERVICE=AZDB3)' *.job_queue_processes=10 *.open_cursors=500 *.pga_aggregate_target=1707081728 *.processes=1500 #*.remote_login_passwordfile='EXCLUSIVE' *.sga_target=1610612736 *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='/data03/oradata/AZDB3/udump' :%s/pstmig3/AZDB3_ix :wq! "initAZDB3.ora" 22 lines, 822 characters AZDB3_ix.__db_cache_size=1157627904 AZDB3_ix.__java_pool_size=33554432 AZDB3_ix.__large_pool_size=16777216 AZDB3_ix.__shared_pool_size=385875968 *.background_dump_dest='/data03/oradata/AZDB3_ix/bdump' *.compatible='10.1.0.5.0' *.control_files='/data03/oradata/AZDB3_ix/control01.ctl','/data03/oradata/AZDB3_ix/control02.c tl','/data03/oradata/AZDB3_ix /control03.ctl' *.core_dump_dest='/data03/oradata/AZDB3_ix/cdump' *.db_block_size=8192 *.db_domain='' *.db_file_multiblock_read_count=16 *.db_name= anar3ix ' *.dispatchers='(PROTOCOL=TCP) (SERVICE=AZDB3_ix)' *.job_queue_processes=10 *.open_cursors=500 *.pga_aggregate_target=1707081728 *.processes=1500 #*.remote_login_passwordfile='EXCLUSIVE' *.sga_target=1610612736
  2. 2. Anar Godjaev http://anargodjaev.wordpress.com/ *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' *.user_dump_dest='/data03/oradata/AZDB3_ix/udump' >mv initAZDB3.ora initAZDB3_ix.ora, 1-a change DB FILE FOLDER NAME >pwd /oracle/product/10.1.0/db_1/dbs >cd /data03/oradata/ > mv AZDB3 AZDB3_ix 2 – Creating new control file for new named database. > export ORACLE_SID=AZDB3 > sqlplus /nolog SQL*PLUS: RELEASE 10.1.0.5.0 - PRODUCTİON ON MON OCT 8 10:07:22 2007 COPYRİGHT (C) 1982, 2005, ORACLE. ALL RİGHTS RESERVED. SQL> conn / as sysdba connected. SQL> SQL> select name from v$database; NAME --------AZDB3 SQL> alter system flush SHARED_POOL; System altered. SQL> alter system flush BUFFER_CACHE; System altered. SQL> ALTER SESSION SET TRACEFILE_IDENTIFIER=ANAR; Session altered. SQL>ALTER DATABASE BACKUP CONTROLFILE TO TRACE; Database altered. SQL> EXIT; > cd /data03/oradata/ AZDB3_ix/udump
  3. 3. Anar Godjaev http://anargodjaev.wordpress.com/ 2-a CHANGE/MODIFY TRACE FILE PATHS AND DBNAME >vi AZDB3_ora_29294_ANAR.trc CREATE CONTROLFILE SET DATABASE " anar3ix" NORESETLOGS NOARCHIVELOG MAXLOGFILES 4 MAXLOGMEMBERS 4 MAXDATAFILES 1000 MAXINSTANCES 1 MAXLOGHISTORY 908 LOGFILE GROUP 1 '/data03/oradata/AZDB3_ix/redo01.log' SIZE 50M, GROUP 2 '/data03/oradata/AZDB3_ix/redo02.log' SIZE 50M, GROUP 3 '/data03/oradata/AZDB3_ix/redo03.log' SIZE 50M -- STANDBY LOGFILE DATAFILE '/data03/oradata/AZDB3_ix/system01.dbf', '/data03/oradata/AZDB3_ix/undo01.dbf', '/data03/oradata/AZDB3_ix/sysaux01.dbf', '/data03/oradata/AZDB3_ix/users01.dbf', '/data03/oradata/AZDB3_ix/data1.dbf', '/data03/oradata/AZDB3_ix/data2.dbf', '/data03/oradata/AZDB3_ix/data3.dbf', '/data03/oradata/AZDB3_ix/data4.dbf', '/data03/oradata/AZDB3_ix/data5.dbf', '/data03/oradata/AZDB3_ix/data6.dbf', '/data03/oradata/AZDB3_ix/data7.dbf', '/data03/oradata/AZDB3_ix/data8.dbf', '/data03/oradata/AZDB3_ix/data9.dbf', '/data03/oradata/AZDB3_ix/data0.dbf', '/data03/oradata/AZDB3_ix/undo02.dbf', '/data03/oradata/AZDB3_ix/undo03.dbf' CHARACTER SET WE8ISO8859P9 ; 3-CREATING CONTROL FILE SQL> conn / as sysdba Connected. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> bash-3.00$ mv AZDB3 AZDB3_ix bash-3.00$ export ORACLE_SID=AZDB3_ix bash-3.00$ sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 3 17:47:33 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> conn / as sysdba Connected to an idle instance. SQL> startup nomount ORACLE instance started. Total System Global Area 1610612736 bytes Fixed Size 1303056 bytes Variable Size 445390320 bytes Database Buffers 1157627904 bytes Redo Buffers 6291456 bytes SQL> !pwd /data03/oradata
  4. 4. Anar Godjaev http://anargodjaev.wordpress.com/ SQL> !cd AZDB3_ix SQL> !pwd /data03/oradata SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production With the Partitioning, OLAP and Data Mining options bash-3.00$ cd AZDB3_ix bash-3.00$ cd udump bash-3.00$ mv *ANAR* create_ctl.sql bash-3.00$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 3 17:55:33 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> @create_ctl.sql CREATE CONTROLFILE SET DATABASE "anar3ix" NORESETLOGS NOARCHIVELOG * ERROR at line 1: ORA-01503: CREATE CONTROLFILE failed ORA-01223: RESETLOGS must be specified to set a new database name SQL> define _editor=vi SQL> ed create_ctl.sql "create_ctl.sql" 30 lines, 1117 characters CREATE CONTROLFILE SET DATABASE "anar3ix" RESETLOGS NOARCHIVELOG MAXLOGFILES 4 MAXLOGMEMBERS 4 MAXDATAFILES 1000 MAXINSTANCES 1 MAXLOGHISTORY 908 LOGFILE GROUP 1 '/data03/oradata/AZDB3_ix/redo01.log' SIZE 50M, GROUP 2 '/data03/oradata/AZDB3_ix/redo02.log' SIZE 50M, GROUP 3 '/data03/oradata/AZDB3_ix/redo03.log' SIZE 50M -- STANDBY LOGFILE DATAFILE '/data03/oradata/AZDB3_ix/system01.dbf', '/data03/oradata/AZDB3_ix/undo01.dbf', '/data03/oradata/AZDB3_ix/sysaux01.dbf', '/data03/oradata/AZDB3_ix/users01.dbf', '/data03/oradata/AZDB3_ix/data1.dbf', '/data03/oradata/AZDB3_ix/data2.dbf', '/data03/oradata/AZDB3_ix/data3.dbf', '/data03/oradata/AZDB3_ix/data4.dbf', '/data03/oradata/AZDB3_ix/data5.dbf', '/data03/oradata/AZDB3_ix/data6.dbf', '/data03/oradata/AZDB3_ix/data7.dbf', '/data03/oradata/AZDB3_ix/data8.dbf', '/data03/oradata/AZDB3_ix/data9.dbf', '/data03/oradata/AZDB3_ix/data0.dbf',
  5. 5. Anar Godjaev http://anargodjaev.wordpress.com/ '/data03/oradata/AZDB3_ix/undo02.dbf', '/data03/oradata/AZDB3_ix/undo03.dbf' CHARACTER SET WE8ISO8859P9 ; ~ ~ "create_ctl.sql" 30 lines, 1115 characters SQL> @create_ctl.sql CREATE CONTROLFILE SET DATABASE "anar3ix" RESETLOGS NOARCHIVELOG * ERROR at line 1: ORA-01503: CREATE CONTROLFILE failed ORA-00200: controlfile could not be created ORA-00202: controlfile: '/data03/oradata/AZDB3_ix/control01.ctl' ORA-27038: created file already exists Additional information: 1 SQL> !rm ../*.ctl SQL> !rm ../*.log SQL> @create_ctl.sql Control file created. SQL> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1610612736 bytes Fixed Size 1303056 bytes Variable Size 445390320 bytes Database Buffers 1157627904 bytes Redo Buffers 6291456 bytes Database mounted. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open SQL> ALTER DATABASE OPEN RESETLOGS; Database altered. SQL> SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/data03/oradata/AZDB3_ix/temp02.dbf' SIZE 524288000 REUSE AUTOEXTEND ON NEXT 104857600 MAXSIZE 4000M; ALTER TABLESPACE TEMP ADD TEMPFILE '/data03/oradata/AZDB3_ix/temp01.dbf' SIZE 524288000 REUSE AUTOEXTEND ON NEXT 5242880 MAXSIZE 524288000 ; Tablespace altered. Tablespace altered.
  6. 6. Anar Godjaev http://anargodjaev.wordpress.com/ SQL> startup ORA-01081: cannot start already-running ORACLE - shut it down first SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1610612736 Fixed Size 1303056 Variable Size 445390320 Database Buffers 1157627904 Redo Buffers 6291456 Database mounted. Database opened. SQL> select name from v$database; NAME --------ANAR3IX SQL> bytes bytes bytes bytes bytes
  7. 7. Anar Godjaev http://anargodjaev.wordpress.com/ SQL> startup ORA-01081: cannot start already-running ORACLE - shut it down first SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1610612736 Fixed Size 1303056 Variable Size 445390320 Database Buffers 1157627904 Redo Buffers 6291456 Database mounted. Database opened. SQL> select name from v$database; NAME --------ANAR3IX SQL> bytes bytes bytes bytes bytes

×