mv datafile and controlfile

8
Anar Godjaev http://anargodjaev.wordpress.com/ MV DATAFILE AND CONTROLFILE root@azkktest # su - oracle Oracle Corporation SunOS 5.10 Generic Patch January 2005 Please connect to DB... 1 --> AZKKTST 2 --> AZKKDEV 3 --> AZKKUAT 4 --> AZTEST 3 -----> enter bash-3.2$ sqlplus '/as sysdba' SQL*Plus: Release 11.2.0.3.0 Production on Thu May 24 11:36:53 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> alter database backup controlfile to trace as '/data/AZKKUAT/uat.txt'; Database altered. SQL> create pfile from spfile; File created. SQL> shu immediate Database closed. Database dismounted.

Upload: anar-godjaev

Post on 13-May-2015

309 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Mv datafile and controlfile

Anar Godjaevhttp://anargodjaev.wordpress.com/

MV DATAFILE AND   CONTROLFILE

root@azkktest # su - oracleOracle Corporation SunOS 5.10 Generic Patch January 2005

Please connect to DB...   1 --> AZKKTST  2 --> AZKKDEV  3 --> AZKKUAT  4 --> AZTEST  3 -----> enter

bash-3.2$ sqlplus '/as sysdba'SQL*Plus: Release 11.2.0.3.0 Production on Thu May 24 11:36:53 2012Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database backup controlfile to trace as '/data/AZKKUAT/uat.txt';Database altered.

SQL> create pfile from spfile;File created.

SQL> shu immediateDatabase closed.Database dismounted.ORACLE instance shut down.

SQL> exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

bash-3.2$ cd /u01/app/oracle/ admin/ checkpoints/ fast_recovery_area/ initAZKKDEV.ora initKBAZER.ora product/ 

Page 2: Mv datafile and controlfile

Anar Godjaevhttp://anargodjaev.wordpress.com/

cfgtoollogs/ diag/ init.ora initAZTEST.ora oradata/ 

bash-3.2$ cd /u01/app/oracle/oradata/AZKKUAT/

bash-3.2$ lscontrol01.ctl redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf

bash-3.2$ mv * /data/AZKKUAT/data/

bash-3.2$ cd ..

bash-3.2$ lsAZKKDEV AZKKUAT

bash-3.2$ cd ..

bash-3.2$ lsadmin checkpoints fast_recovery_area initAZKKDEV.ora initKBAZER.ora productcfgtoollogs diag init.ora initAZTEST.ora oradata

bash-3.2$ cd fast_recovery_area/

bash-3.2$ lsAZKKDEV AZKKUAT

bash-3.2$ cd AZKKUAT/

bash-3.2$ lsarchivelog control02.ctl onlinelog

bash-3.2$ mv control02.ctl /data/AZKKUAT/data/

bash-3.2$ cd $ORACLE_HOME

bash-3.2$ cd dbs/

bash-3.2$ vi initAZKKUAT.ora "initAZKKUAT.ora" 27 lines, 1019 characters AZKKUAT.__db_cache_size=10972299264AZKKUAT.__java_pool_size=33554432AZKKUAT.__large_pool_size=33554432

Page 3: Mv datafile and controlfile

Anar Godjaevhttp://anargodjaev.wordpress.com/

AZKKUAT.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environmentAZKKUAT.__pga_aggregate_target=6878658560AZKKUAT.__sga_target=12884901888AZKKUAT.__shared_io_pool_size=0AZKKUAT.__shared_pool_size=1744830464AZKKUAT.__streams_pool_size=33554432*.audit_file_dest='/u01/app/oracle/admin/AZKKUAT/adump'*.audit_trail='db'*.compatible='11.2.0.0.0'*.control_files='/data/AZKKUAT/data/control01.ctl','/data/AZKKUAT/data/control02.ctl'*.db_block_size=8192*.db_domain=''*.db_name='AZKKUAT'*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'*.db_recovery_file_dest_size=4322230272*.diagnostic_dest='/u01/app/oracle'*.dispatchers='(PROTOCOL=TCP) (SERVICE=AZKKUATXDB)'*.open_cursors=300*.pga_aggregate_target=6871318528*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.sga_max_size=12884901888*.sga_target=12884901888*.undo_tablespace='UNDOTBS1'~~~~~~~~"initAZKKUAT.ora" 27 lines, 982 characters 

bash-3.2$ cd /data/AZKKUAT/

bash-3.2$ vi uat.txt "uat.txt" 143 lines, 5834 characters -- The following are current System-scope REDO Log Archival related-- parameters and can be included in the database initialization file.---- LOG_ARCHIVE_DEST=''

Page 4: Mv datafile and controlfile

Anar Godjaevhttp://anargodjaev.wordpress.com/

-- LOG_ARCHIVE_DUPLEX_DEST=''---- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf---- DB_UNIQUE_NAME="AZKKUAT"---- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'-- LOG_ARCHIVE_MAX_PROCESSES=4-- STANDBY_FILE_MANAGEMENT=MANUAL-- STANDBY_ARCHIVE_DEST=?/dbs/arch-- FAL_CLIENT=''-- FAL_SERVER=''---- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'-- LOG_ARCHIVE_DEST_STATE_1=ENABLE---- Below are two sets of SQL statements, each of which creates a new-- control file and uses it to open the database. The first set opens-- the database with the NORESETLOGS option and should be used only if-- the current versions of all online logs are available. The second-- set opens the database with the RESETLOGS option and should be used-- if online logs are unavailable.-- The appropriate set of statements can be copied from the trace into-- a script file, edited as necessary, and executed when there is a-- need to re-create the control file.---- Set #1. NORESETLOGS case---- The following commands will create a new control file and use it-- to open the database.-- Data used by Recovery Manager will be lost.-- Additional logs may be required for media recovery of offline-- Use this only if the current versions of all online logs are-- available.-- After mounting the created controlfile, the following SQL-- statement will place the database in the appropriate

Page 5: Mv datafile and controlfile

Anar Godjaevhttp://anargodjaev.wordpress.com/

-- protection mode:-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCESTARTUP NOMOUNTCREATE CONTROLFILE REUSE DATABASE "AZKKUAT" NORESETLOGS NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292LOGFILEGROUP 1 '/u01/app/oracle/oradata/AZKKUAT/redo01.log' SIZE 50M BLOCKSIZE 512,GROUP 2 '/u01/app/oracle/oradata/AZKKUAT/redo02.log' SIZE 50M BLOCKSIZE 512,GROUP 3 '/u01/app/oracle/oradata/AZKKUAT/redo03.log' SIZE 50M BLOCKSIZE 512-- STANDBY LOGFILEDATAFILE'/u01/app/oracle/oradata/AZKKUAT/system01.dbf','/u01/app/oracle/oradata/AZKKUAT/sysaux01.dbf','/u01/app/oracle/oradata/AZKKUAT/undotbs01.dbf','/u01/app/oracle/oradata/AZKKUAT/users01.dbf'CHARACTER SET AL32UTF8;-- Commands to re-create incarnation table-- Below log names MUST be changed to existing filenames on-- disk. Any one log file from each branch can be used to-- re-create incarnation records.-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/fast_recovery_area/AZKKUAT/archivelog/2012_05_24/o1_mf_1_1_%u_.arc';-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/fast_recovery_area/AZKKUAT/archivelog/2012_05_24/o1_mf_1_1_%u_.arc';-- Recovery is required if any of the datafiles are restored backups,-- or if the last shutdown was not normal or immediate.RECOVER DATABASE-- Database can now be opened normally.:q!

bash-3.2$ sqlplus '/as sysdba'

Page 6: Mv datafile and controlfile

Anar Godjaevhttp://anargodjaev.wordpress.com/

SQL*Plus: Release 11.2.0.3.0 Production on Thu May 24 11:42:27 2012Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to an idle instance.

SQL> create spfile from pfile;File created.

SQL> startup nomountORACLE instance started.Total System Global Area 1.2831E+10 bytesFixed Size 2171296 bytesVariable Size 1845501536 bytesDatabase Buffers 1.0972E+10 bytesRedo Buffers 11231232 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "AZKKUAT" RESETLOGS NOARCHIVELOG2 MAXLOGFILES 163 MAXLOGMEMBERS 34 MAXDATAFILES 1005 MAXINSTANCES 86 MAXLOGHISTORY 2927 LOGFILE8 GROUP 1 '/data/AZKKUAT/data/redo01.log' SIZE 50M BLOCKSIZE 512,9 GROUP 2 '/data/AZKKUAT/data/redo02.log' SIZE 50M BLOCKSIZE 512,10 GROUP 3 '/data/AZKKUAT/data/redo03.log' SIZE 50M BLOCKSIZE 51211 -- STANDBY LOGFILE12 DATAFILE13 '/data/AZKKUAT/data/system01.dbf',14 '/data/AZKKUAT/data/sysaux01.dbf',15 '/data/AZKKUAT/data/undotbs01.dbf',16 '/data/AZKKUAT/data/users01.dbf'17 CHARACTER SET AL32UTF818 ;Control file created.

SQL> alter database open resetlogs;Database altered.SQL>