Digital UNIX (SCE) (TTYP2)
Login: Oracle
PASSWORD:
Last login: Tue Oct 22 12:03:19 from 172.31.8.6
Digital UNIX V4.0F (Rev. 1229); Wed Aug 22 13:04:08 CST 2001
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:32:36 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> Shutdown
Database closed.
Database dismount.
Oracle Instance Shut Down.
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Oracle @ SCE> DF -K
FileSystem 1024-block used Available Capacity Mounted ON
Root_Domain # root 262144 92876 169268 36% /
/ proc 0 0 0 100% / proc
USR_DOMAIN # usr 2097152 1347333 692072 67% / usr
Oracle_Domain # u01 4954600 4138102 782080 85% / U01
Oracle @ SCE> Oracle_SID = New; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:33:45 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> Shutdown
Database closed.
Database dismount.
Oracle Instance Shut Down.
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Oracle @ SCE>
Start the database SCEDB, then do the following
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> Env | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = SCEDB
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:36:51 2002 (c) Copyright 2000 Oracle Corporation. All Rights Reserved.
Connected to an iDLE Instance.
SQL> Startup
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
Database mounted.
Database opened.
SQL> EXIT
Disconnected
Oracle @ SCE>
Ready to work:
Check if space is enough, then do the following
Prepare some test data
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> Env | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = SCEDB
Oracle @ SCE>
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:05:03 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> SELECT * FROM DBA_DATA_FILES;
File_name file_id tablespace_name Bytes Blocks Status relative_fno autoextensible maxibytes maxBlocks increment_by user_bytes user_blocks
-------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ---------------------------
/u01/oracle/oradata/scedb/system01.dbf 1 system 283115520 34560 Available 1 Yes 3435972198 4194302 1280 283107328 34559
/ u 0DB /TOOLS01.DBF 2 Tools 8388608 1024 Available 2 Yes 3435972198 4194302 40 8380416 1023
/u01/oracle/oradata/scedb/rbs01.dbf 3 RBS 104857600 12800 Available 3 Yes 3435972198 4194302 640 104849408 12799
/u01/oracle/oradata/SCEDB/temp01.dbf 4 TEMP 71303168 8704 AVAILABLE 4 YES 3435972198 4194302 80 71294976 8703 / u01 / oracle / oradata / SCEDB / users01.dbf 5 USERS 52428800 6400 AVAILABLE 5 YES 3435972198 4194302 160 52420608 6399
/u01/oracle/roadata/scedb/indx01.dbf 6 INDX 20971520 2560 Available 6 Yes 3435972198 4194302 160 20963328 2559
/ Yu01/oracle/roadata/scedb/drsys01.dbf 7 Drsys 88080384 10752 Available 7 Yes 3435972198 4194302 80 88072192 10751
/ Yu01/oracle/roadata/scedb/lunar01.dbf 8 Lunar 10485760 1280 Available 8 NO 0 0 0 10477568 1279
8 rows success
SQL> SELECT * FROM V $ ControlFile;
STATUS NAME
------------------------------------------------- -------------------------------------
/ /u01/oracle/oradata/scedb/control01.ctl
/ u 0DB/CONTROL02.CTL
/u01/oracle/roadata/scedb/control03.ctl
SQL> SELECT * FROM V $ logfile;
Group # status member
---------- --------------------------------------- -----------------------------------------------
1 /u01/oracle/oradata/scedb/redo01.log
2 /u01/oracle/oradata/scedb/redo02.log
3 stale /u01/oracle/oradata/scedb/redo03.log
SQL> SELECT SUM (BYTES) from DBA_DATA_FILES;
Sum (Bytes)
------------
639631360
SQL>
SQL> SELECT FILE_NAME DATAFILE_NAME
2, TableSpace_name
3, TO_CHAR (bytes / 1024/1024) || 'M' MBYTES
4 from DBA_DATA_FILES
5 ORDER by file_name
6, TableSpace_name
7 /
DataFile_name TableSpace_name mbytes
-------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------- -------------------------------------------------------------------------------------------------------------------------------- -
/u01/oracle/oradata/scedb/drsys01.dbf drsys 84M
/u01/oracle/oradata/scedb/indx01.dbf IndX 20m
/u01/oracle/oradata/scedb/lunar01.dbf lunar 10m
/u01/oracle/roadata/scedb/rbs01.dbf RBS 100M / U01 / Oracle / ORADATA / SCEDB / SYSTEM01.DBF SYSTEM 270M
/u01/oracle/oradata/scedb/temp01.dbf Temp 68M
/ /u01/oracle/oradata/scedb/tools01.dbf Tools 8M
/u01/oracle/oradata/scedb/users01.dbf users 50M
8 rows success
SQL>
SQL> SELECT B.FILE_ID FILE_ID,
2 b.Tablespace_name TableSpace_name,
3 B.Bytes Bytes,
4 (B.Bytes-sum (NVL (A.BYTES, 0)))))).
5 Sum (NVL (A.BYTES, 0)) Free,
6 Sum (NVL (A.BYTES, 0)) / (B.BYTES) * 100 percent
7 from DBA_FREE_SPACE A, DBA_DATA_FILES B
8 where a.file_id = B.File_ID
9 Group by b.tablespace_name, b.file_id, B.BYTES
10 ORDER by B.File_ID
11 /
FILE_ID TABLESPACE_NAME BYTES Used Free Percent
---------- ---------------------------------------- ---------- --------------------
1 System 28311552 269959168 13156352 4.64699074
2 Tools 8388608 40960 8347648 99.5117187
3 RBS 104857600 20979712 83877887 79.9921875
4 Temp 71303168 8192 71294976 99.9885110
5 Users 52428800 8192 52420608 99.984375
6 INDX 20971520 8192 20963328 99.9609375
7 Drsys 88080384 4333568 83746816 95.0799851
8 lunar 10485760 49152 10436608 99.53125
8 rows success
SQL> Conn Lunar / Lunar
Connected.
SQL> SELECT * from Tab;
TName Tabtype ClusterID
----------------------------------------------
Test Table
SQL> SELECT *.
A
------------
1
SQL> INSERT INTO TEST VALUES (2);
1 row created.
SQL> commit;
COMMIT COMPLETE.
SQL> INSERT INTO TEST VALUES (3);
1 row created.
SQL> SELECT *.
A
------------
1
2
3
SQL>
Note 3 is not submitted, 2 has been submitted, but 2 has not been filed yet
That is, these two data are in REDO, but the status is different.
New open a window as a switch log:
Digital UNIX (SCE) (TTYP1)
Login: Oracle
PASSWORD:
Last login: Tue Oct 22 12:32:18 from 172.31.8.6
Digital UNIX V4.0F (Rev. 1229); Wed Aug 22 13:04:08 CST 2001Oracle @ SCE> Oracle_sid = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:50:11 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> Archive log List
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2774
Next log sequence to archive 2776
Current Log Sequence 2776
SQL> ALTER SYSTEM SWITCH LOGFILE;
SYSTEM altered.
SQL> Archive log List
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2775
Next log sequence to archive 2777
Current log sequence 2777
SQL>
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
So far, there are 2 archives in the table TEST of the user, ie 1 and 2.
There is also an unsubmitted in REDO, ie 3;
Now you are hot in the new window (SQLUS Internal), the current Archive log is 2777,
Note that the Archive log after the hot standby is observed, and record it to control the data reply.
First, determine oracle_sid
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:05:03 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Second, if the following directory does not exist, create the following directory first
Oracle @ SCE> CD / U01 / ORACLE / BACKUP2 Established in / U01 / Oracle / Backup2 to establish a directory required by Cologne database
Mkdir Adhoc
MKDIR BDUMP
MKDIR CDUMP
Mkdir Arch
Mkdir Create
MKDIR EXP
MKDIR UDUMP
Mkdir Pfile
Oracle @ SCE> LS
Oracle @ SCE>
Third, check the disk space, if you are enough, create a hot standby
Oracle @ SCE> DF -K
FileSystem 1024-block used Available Capacity Mounted ON
Root_Domain # root 262144 92876 169268 36% /
/ proc 0 0 0 100% / proc
USR_DOMAIN # usr 2097152 1347469 691936 67% / usr
Oracle_Domain # u01 4954600 4138277 781928 85% / U01
Oracle @ SCE>
Oracle @ SCE> CD / U01 / Oracle / Back_Script
Oracle @ SCE> LS HotBack2.sh
HotBack2.sh
Oracle @ SCE> HotBack2.sh
Tue Oct 22 13:27:13 GMT 0700 2002
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 13:27:13 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
Tue Oct 22 13:27:13 GMT 0700 2002
Connected.
Begining Archive log number is:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2776
Next log sequence to archive 2778
Current Log Sequence 2778
Begin Backup TableSpace System ...
Successed End Backup this file.
Begin Backup TableSpace Tools ...
Successed End Backup this file.
Begin Backup TableSpace RBS ...
Successed End Backup this file.
Begin Backup TableSpace Temp ...
Successed End Backup this file.
Begin Backup TableSpace Uses ...
Successed End Backup this file.
Begin Backup TableSpace IndX ...
Successed End Backup this file.
Begin Backup TableSpace Drsys ...
Successed End Backup this file.
Begin Backup TableSpace Lunar ...
Successed End Backup this file .begin backup controlfile to /u01/oracle/backup2/controlfile01.ctl ...
Successed End Backup The ControlFile.
Begin Backup ControlFile to TRACE ...
Successed End Backup The ControlFile.
Before Switch Log, The Current Log IS:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2776
Next log sequence to archive 2778
Current Log Sequence 2778
Begin Backup Switch Current Log ...
Successed End Switch Log.
After Switch log, The Ending Archive log number is:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2777
Next log sequence to archive 2779
Current log sequence 2779
Tue Oct 22 13:29:35 GMT 0700 2002
Start Backup Archive log (Arch1) ...
End Backup Archive log (Arch1) ...
Tue Oct 22 13:29:35 GMT 0700 2002
Tue Oct 22 13:29:35 GMT 0700 2002
SQL>
SQL> - Set Termout ON;
SQL>
SQL> EXIT;
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Tue Oct 22 13:29:38 GMT 0700 2002
Oracle @ SCE>
Fourth, confirm the hot standby (including checking the hot-standing log)
Oracle @ SCE> CD / U01 / ORACLE / BACKUP2
Oracle @ SCE> LS -L
Total 629293
DRWXR-XR-X 2 Oracle DBA 8192 Oct 22 13:03 Adhoc
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:29 Arch
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 BDUMP
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 CDUMP
-rw-r ----- 1 Oracle DBA 4628480 OCT 22 13:29 ControlFile01.ctl
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 Create
-rw-r ----- 1 Oracle DBA 88088576 OCT 22 13:29 drsys01.dbf
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 EXP
-rw-r ----- 1 Oracle DBA 20979712 OCT 22 13:29 Indox01.dbf-rw-r - r - 1 Oracle DBA 4664 OCT 22 11:10 Initnew2.ora
-rw-r ----- 1 Oracle DBA 10493952 OCT 22 13:29 lunar01.dbf
DRWXR-XR-X 2 Oracle DBA 8192 Oct 22 13:03 Pfile
-rw-r ----- 1 Oracle DBA 104865792 OCT 22 13:28 rbs01.dbf
-rw-r ----- 1 Oracle DBA 283123712 OCT 22 13:28 system01.dbf
-rw-r ----- 1 Oracle DBA 71311360 OCT 22 13:28 TEMP01.DBF
-rw-r ----- 1 Oracle DBA 8396800 OCT 22 13:28 Tools01.dbf
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 UDUMP
-rw-r ----- 1 Oracle DBA 52436992 OCT 22 13:29 users01.dbf
Oracle @ SCE>
V. Set new oracle_sid
Oracle @ SCE> Oracle_sid = new2; export oracle_sid
Oracle @ SCE>
6. Prepare the documents needed by the Cologne database
Create initnew2.ora (/u01/oracle/backup/initisw2.ora)
DB_NAME = "new2"
INSTANCE_NAME = New2
Service_names = new2
Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
LOG_ARCHIVE_START = TRUE
LOG_ARCHIVE_DEST = "/ u01 / oracle / backup2 / arch"
LOG_ARCHIVE_FORMAT = Arch_% T_% S.ARC
Background_dump_dest = / u01 / oracle / backup2 / bdump
Core_dump_dest = / u01 / oracle / backup2 / cdump
User_dump_dest = / u01 / oracle / backup2 / udump
In order not to reconstruct the password file, you will be temporarily annotated.
#remote_login_passwordfile = Exclusive
Modify the original listener.ora (/u01/oracle/orahome1/neetwork/admin/listener.ora)
Join:
Listener2 =
(Description_List =
(Description =
(Address_list =
(Address = (protocol = TCP) (Host = SCE) (port = 1522)))
)
)
)
SID_LIST_LISTENER2 =
(SID_LIST =
(SID_DESC =
(Global_dbname = new2)
(Oracle_Home = / u01 / oracle / orahome1)
(SID_NAME = New2)
)
)
Modify the original TNSNames.ora (/u01/oracle/orahome1/neetwork/admin/listener.ora)
Join:
NEW2 = (description =
(Address_list =
(Address = (protocol = TCP) (Host = SCE) (port = 1522)))
)
(Connect_data =
(Service_name = new2)
)
)
Seven, start the monitoring of new databases
Oracle @ SCE> LSNRCTL
Lsnrctl for dec OSF / 1 AXP: Version 8.1.7.0.0 - Production On 22-Oct-2002 13:36:03
(c) CopyRight 1998 Oracle Corporation. All Rights Reserved.
Welcome to lsnrctl, Type "Help" for Information.
LSNRCTL> Start Listener2
Starting / u01 / oracle / orahome1 / bin / tnslsnr: please wait ...
TNSLSNR for Dec OSF / 1 AXP: Version 8.1.7.0.0 - Production
System parameter file is /u01/oracle/orahome1/neetwork/admin/listener.ora
Log Messages Written to /u01/oracle/orahome1/neetwork/log/listener2.log
Listening ON: (deScription = (address = (protocol = tcp) (host = SCE))))))))
Connecting to (deScription = (protocol = tcp) (host = SCE)))))))
Status of the listener
---------------------------------------------------------------------------------------------------------------------------------------
Alias Listener2
Version TNSLSNR for Dec OSF / 1 AXP: Version 8.1.7.0.0 - Production
Start date 22-oct-2002 13:36:14
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level Off
Security off
SNMP OFF
Listener parameter file /u01/oracle/orahome1/neetwork/admin/listener.ora
Listener log file /u01/oracle/orahome1/neetwork/log/listener2.log
Services Summary ...
New2 HAS 1 Service Handler (S)
THE Command Complated SuccessFully
LSNRCTL> EXIT
Oracle @ SCE>
============================================================================================================================================================================================================= ======================================== this is not ====== ==============================
============================================================================================================================================================================================================= ==================
Eight, use initnew2.ora to come nomount database
Oracle @ SCE> Oracle_sid = new2; export oracle_sid
Oracle @ SCE> SQLPLUS / NOLOG
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:26:39 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
SQL> CONN INTERNAL
Connected to an iDLE Instance.
SQL> Startup Nomount Pfile = / u01 / oracle / backup2 / initnew2.ora
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
SQL>
============================================================================================================================================================================================================= ==================================================================================================================================================================== =================================================================================================================================================================================
============================================================================================================================================================================================================= ==================
Nine, with Backup ControlFile to TRACE backup control files on the main database
(Ie, create a tracking file for the control file. This is for the control file for the new database later)
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 13:36:58 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> ALTER DATABASE Backup ControlFile to TRACE;
Database altered.
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Oracle @ SCE>
Ten, edit the tracking file, save it as a SQL script (ready to create a trace file for new database)
Pay attention to 3 places:
(1). SET DATABASE "New2" Resetlogs
(2). Logfile
Group 1 '/u01/oracle/backup2/redo01.log' size 500K,
Group 2 '/u01/oracle/backup2/redo02.log' size 500K,
Group 3 '/u01/oracle/backup2/redo03.log' size 500K
(3). DataFile
'/u01/oracle/backup2/system01.dbf',
'/u01/oracle/backup2/tools01.dbf',
'/u01/oracle/backup2/rbs01.dbf',
'/u01/oracle/backup2/temp01.dbf',
'/u01/oracle/backup2/Users01.dbf',
'/u01/oracle/backup2/indx01.dbf',
'/u01/oracle/backup2/drsys01.dbf',
'/u01/oracle/backup2/lunar01.dbf'
The script for creating a new control file is as follows:
Create ControlFile Set Database "New2" ResetLogs ArchiveLog
MaxLogfiles 32
MaxLogmembers 2
MaxDatafiles 254
MaxInstances 8
MaxLoghistory 3630
Logfile
Group 1 '/u01/oracle/backup2/redo01.log' size 500K,
Group 2 '/u01/oracle/backup2/redo02.log' size 500k,
Group 3 '/u01/oracle/backup2/redo03.log' size 500K
DataFile
'/u01/oracle/backup2/system01.dbf',
'/u01/oracle/backup2/tools01.dbf',
'/u01/oracle/backup2/rbs01.dbf',
'/u01/oracle/backup2/temp01.dbf',
'/u01/oracle/backup2/Users01.dbf',
'/u01/oracle/backup2/indx01.dbf',
'/u01/oracle/backup2/drsys01.dbf',
'/u01/oracle/backup2/lunar01.dbf'
Character set US7ASCII
;
11. Execute this script, create a control file
============================================================================================================================================================================================================= ==================
====================== This is not to do ======================== ============================================================================================================================================================================================================= ==============================
(1). Modify Initnew.ora, re-specify the name of the control file
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
Control_files = ("/u01/oracle/backup2/control01.ctl")
============================================================================================================================================================================================================= ==================
It has been proven that if you don't do this, you will make an error below:
Do it in the eleventh step (4), it will be wrong
SQL> @ / u01 / oracle / back_script / ora_1381.sql
Create ControlFile Set Database "New2" ResetLogs ArchiveLog
*
Error At Line 1:
ORA-01503: Create ControlFile Failed
ORA-00200: ControlFile Could Not Be CREATED
ORA-00202: ControlFile: '/u01/oracle/backup2/controlfile01.ctl'
ORA-27038: SKGFRCRE: File EXISTS
SQL>
If an error, you will return from this step back from this step.
============================================================================================================================================================================================================= ==================================================================================================================================================================== =================================================================================================================================================================================
============================================================================================================================================================================================================= ==================
(2). Set Oracle_SID = New2
Oracle @ SCE> Oracle_sid = new2; export oracle_sid
(3). With pfile = / u01 / oracle / backup2 / initnew2.ora to Nomount database
Oracle @ SCE> SQLPLUS / NOLOG
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:26:39 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
SQL> CONN INTERNAL
Connected to an iDLE Instance.
SQL> Startup Nomount Pfile = / u01 / oracle / backup2 / initnew2.ora
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
SQL>
OK is a new database
SQL> Host
$ ENV | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_Home = / u01 / oracle / orahome1Oracle_sid = new2
$ EXIT
SQL>
(4). Execute the script of the creation control file
SQL> @ / u01 / oracle / back_script / ora_9413.sql
Control File Created.
SQL>
This step is performed, and the database will create a control file in the location specified in Initnew2.ora.
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
Control_files = ("/u01/oracle/backup2/control01.ctl")
SQL> Host
$ CD / U01 / Oracle / Backup2
$ ls
$
It can be seen that Control01.ctl has been created
(6). SHUTDOWN database
SQL> Shutdown Immediate
ORA-01109: Database Not Open
Database dismount.
Oracle Instance Shut Down.
SQL>
============================================================================================================================================================================================================= ==================
====================== This is not to do ======================== ===========
============================================================================================================================================================================================================= ==================
(7). Modify the location and name of the control file in the initnew2.ora
change into
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
#Control_files = ("/u01/oracle/backup2/control01.ctl")
Control_files = ("/u01/oracle/backup2/control02.ctl" )================================== ==================================
========================= 下 照 = ========================= =========================
============================================================================================================================================================================================================= ==================
(8). Re-nomount pfile = / u01 / oracle / backup2 / initnew2.ora
$ EXIT
SQL> Startup Nomount Pfile = / u01 / oracle / backup2 / initnew2.ora
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
SQL>
============================================================================================================================================================================================================= ======================================== this is not ====== ==============================
============================================================================================================================================================================================================= ==================
(9). Execute the script that creates control files again
SQL> @ / u01 / oracle / back_script2 / ora_9413.sql
Cluster altered.
SQL>
This step is performed, and the database will create a control file in the location specified in Initnew.ora.
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
#Control_files = ("/u01/oracle/backup2/control01.ctl")
Control_files = ("/u01/oracle/backup2/control02.ctl")
SQL> Host
$ CD / U01 / Oracle / Backup2
$ ls
$
It can be seen that Control02.ctl has been created
12. Restore databases (with auto)
$ EXIT
============================================================================================================================================================================================================= ==================================================================================================================================================================== =================================================================================================================================================================================
============================================================================================================================================================================================================= ==================
SQL> ALTABASE MOUNT;
Database altered.
SQL>
SQL> Recover Database Using Backup ControlFile;
ORA-00279: Change 557654 generated at 10/22/2002 13:27:13 Needed for thread 1
ORA-00289: Suggestion: /u01/oracle/backup2/Arch/arch_1_2778.arc
ORA-00280: Change 557654 for thread 1 is in sequence # 2778
Specify log: {
Auto ------------ Knock "Auto"
ORA-00279: Change 557671 Generated at 10/22/2002 13:29:34 Needed for Thread 1
ORA-00289: Suggestion: /u01/oracle/backup2/Arch/arch_1_2779.arc
ORA-00280: Change 557671 for thread 1 is in sequence # 2779
ORA-00278: log file '/u01/oracle/backup2/Arch/arch_1_2778.arc' no longer neededfor this recovery
ORA-00308: Cannot Open Archived log '/u01/oracle/backup2/ArCh/arch_1_2779.arc'
ORA-27037: UNABLE TO OBTAIN FILE STATUS
Compaq Tru64 Unix Error: 2: No Such File or Directory
AdditionAl Information: 3
SQL>
Thirteen, recover again (with Cancel)
Compare the "After Switch Log" in the front hot spare value day, make sure that all the logs have been restored:
After Switch log, The Ending Archive log number is:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2777
Next log sequence to archive 2779
Current log sequence 2779
The current 2779, then recovered to 2778, taking the "Cancel" when the prompt 2779
SQL> Recover Database Use Backup ControlFile Until Cancel;
ORA-00279: Change 557671 Generated at 10/22/2002 13:29:34 Needed for Thread 1
ORA-00289: Suggestion: /u01/oracle/backup2/Arch/arch_1_2779.arc
ORA-00280: Change 557671 for thread 1 is in sequence # 2779
Specify log: {
Cancel ------------ Knock "Cancel"
Media recovery canceled.
SQL>
14, open the database with Open ResetLogs
This step has established the Redo Log file specified in Initnew.ora and opens the database.
SQL> ALTER DATABASE OPEN RESETLOGS;
Database altered.
SQL>
Fifteen, verify that the data is restored
For convenience, you can open a session (window),
And set Oracle_SID = SCEDB; Export Oracle_sid
Then open the old database, and the new database is compared.
In the window (old database):
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> Env | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = SCEDB
Oracle @ SCE> SQLPlus Lunar / Lunar
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:47:23 2002 (C) Copyright 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> SELECT *.
A
------------
1
2
3
SQL>
In the window 2 (new database):
SQL> Conn Lunar / Lunar
Connected.
SQL> SELECT *.
A
------------
1
2
SQL>
Verified the database except for Redo's no reply, all of the files that archived
(Refer to the initial assumption:
So far, there are 2 archives in the table TEST of the user, ie 1 and 2.
There is also an unsubmitted in REDO, ie 3;
Now you are hot in the new window (SQLUS Internal), the current Archive log is 2777,
Note that the Archive log after the hot standby is observed, and record it to control the data reply.
)
Conclusion: This thermal backup is backup for valid database
First, the two databases are now DOWN, one side space or resources are not enough, then do the following:
Digital UNIX (SCE) (TTYP2)
Login: Oracle
PASSWORD:
Last login: Tue Oct 22 12:03:19 from 172.31.8.6
Digital UNIX V4.0F (Rev. 1229); Wed Aug 22 13:04:08 CST 2001
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:32:36 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> Shutdown
Database closed.
Database dismount.
Oracle Instance Shut Down.
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Oracle @ SCE> DF -K
FileSystem 1024-block used Available Capacity Mounted ON
Root_Domain # root 262144 92876 169268 36% /
/ proc 0 0 0 100% / proc
USR_DOMAIN # usr 2097152 1347333 692072 67% / usr
Oracle_Domain # u01 4954600 4138102 782080 85% / U01
Oracle @ SCE> Oracle_sid = New; Export Oracle_sidoracle @ SCE> SQLPLUS Internal
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:33:45 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> Shutdown
Database closed.
Database dismount.
Oracle Instance Shut Down.
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Oracle @ SCE>
Start the database SCEDB, then do the following
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> Env | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = SCEDB
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:36:51 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to an iDLE Instance.
SQL> Startup
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
Database mounted.
Database opened.
SQL> EXIT
Disconnected
Oracle @ SCE>
Ready to work:
Check if space is enough, then do the following
Prepare some test data
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> Env | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = SCEDB
Oracle @ SCE>
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:05:03 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
JServer Release 8.1.7.0.0 - Productionsql> SELECT * FROM DBA_DATA_FILES;
File_name file_id tablespace_name Bytes Blocks Status relative_fno autoextensible maxibytes maxBlocks increment_by user_bytes user_blocks
-------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------- ----------------------------------- ---------------------------
/u01/oracle/oradata/scedb/system01.dbf 1 system 283115520 34560 Available 1 Yes 3435972198 4194302 1280 283107328 34559
/ u 0DB /TOOLS01.DBF 2 Tools 8388608 1024 Available 2 Yes 3435972198 4194302 40 8380416 1023
/u01/oracle/oradata/scedb/rbs01.dbf 3 RBS 104857600 12800 Available 3 Yes 3435972198 4194302 640 104849408 12799
/u01/oracle/oradata/scedb/temp01.dbf 4 Temp 71303168 8704 Available 4 Yes 3435972198 4194302 80 71294976 8703
/u01/oracle/roadata/scedb/users01.dbf 5 Users 52428800 6400 Available 5 Yes 3435972198 4194302 160 52420608 6399
/u01/oracle/roadata/scedb/indx01.dbf 6 INDX 20971520 2560 Available 6 Yes 3435972198 4194302 160 20963328 2559
/ Yu01/oracle/roadata/scedb/drsys01.dbf 7 Drsys 88080384 10752 Available 7 Yes 3435972198 4194302 80 88072192 10751
/ Yu01/oracle/roadata/scedb/lunar01.dbf 8 Lunar 10485760 1280 Available 8 NO 0 0 0 10477568 1279
8 rows success
SQL> SELECT * FROM V $ ControlFile;
STATUS NAME
------------------------------------------------- -------------------------------------
/ /u01/oracle/oradata/scedb/control01.ctl
/ u 0DB/CONTROL02.CTL
/u01/oracle/roadata/scedb/control03.ctl
SQL> SELECT * FROM V $ logfile;
Group # status member
---------- --------------------------------------- ----------------------------------------------- 1 / U01 / Oracle/oradata/sCedb/redo01.log
2 /u01/oracle/oradata/scedb/redo02.log
3 stale /u01/oracle/oradata/scedb/redo03.log
SQL> SELECT SUM (BYTES) from DBA_DATA_FILES;
Sum (Bytes)
------------
639631360
SQL>
SQL> SELECT FILE_NAME DATAFILE_NAME
2, TableSpace_name
3, TO_CHAR (bytes / 1024/1024) || 'M' MBYTES
4 from DBA_DATA_FILES
5 ORDER by file_name
6, TableSpace_name
7 /
DataFile_name TableSpace_name mbytes
-------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------- -------------------------------------------------------------------------------------------------------------------------------- -
/u01/oracle/oradata/scedb/drsys01.dbf drsys 84M
/u01/oracle/oradata/scedb/indx01.dbf IndX 20m
/u01/oracle/oradata/scedb/lunar01.dbf lunar 10m
/u01/oracle/oradata/scedb/rbs01.dbf RBS 100M
/u01/oracle/oradata/scedb/system01.dbf system 270m
/u01/oracle/oradata/scedb/temp01.dbf Temp 68M
/ /u01/oracle/oradata/scedb/tools01.dbf Tools 8M
/u01/oracle/oradata/scedb/users01.dbf users 50M
8 rows success
SQL>
SQL> SELECT B.FILE_ID FILE_ID,
2 b.Tablespace_name TableSpace_name,
3 B.Bytes Bytes,
4 (B.Bytes-sum (NVL (A.BYTES, 0)))))).
5 Sum (NVL (A.BYTES, 0)) Free,
6 Sum (NVL (A.BYTES, 0)) / (B.BYTES) * 100 percent
7 from DBA_FREE_SPACE A, DBA_DATA_FILES B
8 where a.file_id = B.File_ID
9 Group by b.tablespace_name, b.file_id, B.BYTES
10 ORDER by B.File_ID
11 /
FILE_ID TABLESPACE_NAME BYTES Used Free Percent
---------- ---------------------------------------- ---------- --------------------
1 System 28311552 269959168 13156352 4.64699074
2 Tools 8388608 40960 8347648 99.5117187
3 RBS 104857600 20979712 83877887 79.9921875
4 Temp 71303168 8192 71294976 99.98851105 Users 52428800 8192 52420608 99.984375
6 INDX 20971520 8192 20963328 99.9609375
7 Drsys 88080384 4333568 83746816 95.0799851
8 lunar 10485760 49152 10436608 99.53125
8 rows success
SQL> Conn Lunar / Lunar
Connected.
SQL> SELECT * from Tab;
TName Tabtype ClusterID
----------------------------------------------
Test Table
SQL> SELECT *.
A
------------
1
SQL> INSERT INTO TEST VALUES (2);
1 row created.
SQL> commit;
COMMIT COMPLETE.
SQL> INSERT INTO TEST VALUES (3);
1 row created.
SQL> SELECT *.
A
------------
1
2
3
SQL>
Note 3 is not submitted, 2 has been submitted, but 2 has not been filed yet
That is, these two data are in REDO, but the status is different.
New open a window as a switch log:
Digital UNIX (SCE) (TTYP1)
Login: Oracle
PASSWORD:
Last login: Tue Oct 22 12:32:18 from 172.31.8.6
Digital UNIX V4.0F (Rev. 1229); Wed Aug 22 13:04:08 CST 2001
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:50:11 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> Archive log List
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2774
Next log sequence to archive 2776
Current Log Sequence 2776
SQL> ALTER SYSTEM SWITCH LOGFILE;
SYSTEM altered.
SQL> Archive log List
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2775
Next log sequence to archive 2777
Current log sequence 2777
SQL>
SQL> EXITDISCONNECTED from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
So far, there are 2 archives in the table TEST of the user, ie 1 and 2.
There is also an unsubmitted in REDO, ie 3;
Now you are hot in the new window (SQLUS Internal), the current Archive log is 2777,
Note that the Archive log after the hot standby is observed, and record it to control the data reply.
First, determine oracle_sid
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:05:03 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Second, if the following directory does not exist, create the following directory first
Oracle @ SCE> CD / U01 / ORACLE / BACKUP2
Create a directory required to establish Cologne database in / u01 / oracle / backup2
Mkdir Adhoc
MKDIR BDUMP
MKDIR CDUMP
Mkdir Arch
Mkdir Create
MKDIR EXP
MKDIR UDUMP
Mkdir Pfile
Oracle @ SCE> LS
Oracle @ SCE>
Third, check the disk space, if you are enough, create a hot standby
Oracle @ SCE> DF -K
FileSystem 1024-block used Available Capacity Mounted ON
Root_Domain # root 262144 92876 169268 36% /
/ proc 0 0 0 100% / proc
USR_DOMAIN # usr 2097152 1347469 691936 67% / usr
Oracle_Domain # u01 4954600 4138277 781928 85% / U01
Oracle @ SCE>
Oracle @ SCE> CD / U01 / Oracle / Back_Script
Oracle @ SCE> LS HotBack2.sh
HotBack2.sh
Oracle @ SCE> HotBack2.sh
Tue Oct 22 13:27:13 GMT 0700 2002
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 13:27:13 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
Tue Oct 22 13:27:13 GMT 0700 2002Connected.
Begining Archive log number is:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2776
Next log sequence to archive 2778
Current Log Sequence 2778
Begin Backup TableSpace System ...
Successed End Backup this file.
Begin Backup TableSpace Tools ...
Successed End Backup this file.
Begin Backup TableSpace RBS ...
Successed End Backup this file.
Begin Backup TableSpace Temp ...
Successed End Backup this file.
Begin Backup TableSpace Uses ...
Successed End Backup this file.
Begin Backup TableSpace IndX ...
Successed End Backup this file.
Begin Backup TableSpace Drsys ...
Successed End Backup this file.
Begin Backup TableSpace Lunar ...
Successed End Backup this file.
Begin Backup ControlFile To /u01/oracle/backup2/controlfile01.ctl ...
Successed End Backup The ControlFile.
Begin Backup ControlFile to TRACE ...
Successed End Backup The ControlFile.
Before Switch Log, The Current Log IS:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2776
Next log sequence to archive 2778
Current Log Sequence 2778
Begin Backup Switch Current Log ...
Successed End Switch Log.
After Switch log, The Ending Archive log number is:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2777
Next log sequence to archive 2779
Current log sequence 2779
Tue Oct 22 13:29:35 GMT 0700 2002
Start Backup Archive log (Arch1) ...
End Backup Archive log (Arch1) ...
Tue Oct 22 13:29:35 GMT 0700 2002
Tue Oct 22 13:29:35 GMT 0700 2002SQL>
SQL> - Set Termout ON;
SQL>
SQL> EXIT;
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Tue Oct 22 13:29:38 GMT 0700 2002
Oracle @ SCE>
Fourth, confirm the hot standby (including checking the hot-standing log)
Oracle @ SCE> CD / U01 / ORACLE / BACKUP2
Oracle @ SCE> LS -L
Total 629293
DRWXR-XR-X 2 Oracle DBA 8192 Oct 22 13:03 Adhoc
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:29 Arch
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 BDUMP
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 CDUMP
-rw-r ----- 1 Oracle DBA 4628480 OCT 22 13:29 ControlFile01.ctl
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 Create
-rw-r ----- 1 Oracle DBA 88088576 OCT 22 13:29 drsys01.dbf
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 EXP
-rw-r ----- 1 Oracle DBA 20979712 OCT 22 13:29 Indox01.dbf
-rw-r - r - 1 Oracle DBA 4664 Oct 22 11:10 Initnew2.ora
-rw-r ----- 1 Oracle DBA 10493952 OCT 22 13:29 lunar01.dbf
DRWXR-XR-X 2 Oracle DBA 8192 Oct 22 13:03 Pfile
-rw-r ----- 1 Oracle DBA 104865792 OCT 22 13:28 rbs01.dbf
-rw-r ----- 1 Oracle DBA 283123712 OCT 22 13:28 system01.dbf
-rw-r ----- 1 Oracle DBA 71311360 OCT 22 13:28 TEMP01.DBF
-rw-r ----- 1 Oracle DBA 8396800 OCT 22 13:28 Tools01.dbf
DRWXR-XR-X 2 Oracle DBA 8192 OCT 22 13:03 UDUMP
-rw-r ----- 1 Oracle DBA 52436992 OCT 22 13:29 users01.dbf
Oracle @ SCE>
V. Set new oracle_sid
Oracle @ SCE> Oracle_sid = new2; export oracle_sid
Oracle @ SCE>
6. Prepare the documents needed by the Cologne database
Create initnew2.ora (/u01/oracle/backup/initisw2.ora)
DB_NAME = "new2"
INSTANCE_NAME = New2
Service_names = new2
Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
LOG_ARCHIVE_START = TRUE
Log_archive_dest = "/ u01 / oracle / backup2 / arch" log_archive_format = arch_% t_% s.arc
Background_dump_dest = / u01 / oracle / backup2 / bdump
Core_dump_dest = / u01 / oracle / backup2 / cdump
User_dump_dest = / u01 / oracle / backup2 / udump
In order not to reconstruct the password file, you will be temporarily annotated.
#remote_login_passwordfile = Exclusive
Modify the original listener.ora (/u01/oracle/orahome1/neetwork/admin/listener.ora)
Join:
Listener2 =
(Description_List =
(Description =
(Address_list =
(Address = (protocol = TCP) (Host = SCE) (port = 1522)))
)
)
)
SID_LIST_LISTENER2 =
(SID_LIST =
(SID_DESC =
(Global_dbname = new2)
(Oracle_Home = / u01 / oracle / orahome1)
(SID_NAME = New2)
)
)
Modify the original TNSNames.ora (/u01/oracle/orahome1/neetwork/admin/listener.ora)
Join:
NEW2 =
(Description =
(Address_list =
(Address = (protocol = TCP) (Host = SCE) (port = 1522)))
)
(Connect_data =
(Service_name = new2)
)
)
Seven, start the monitoring of new databases
Oracle @ SCE> LSNRCTL
Lsnrctl for dec OSF / 1 AXP: Version 8.1.7.0.0 - Production On 22-Oct-2002 13:36:03
(c) CopyRight 1998 Oracle Corporation. All Rights Reserved.
Welcome to lsnrctl, Type "Help" for Information.
LSNRCTL> Start Listener2
Starting / u01 / oracle / orahome1 / bin / tnslsnr: please wait ...
TNSLSNR for Dec OSF / 1 AXP: Version 8.1.7.0.0 - Production
System parameter file is /u01/oracle/orahome1/neetwork/admin/listener.ora
Log Messages Written to /u01/oracle/orahome1/neetwork/log/listener2.log
Listening ON: (deScription = (address = (protocol = tcp) (host = SCE))))))))
Connecting to (deScription = (protocol = tcp) (host = SCE)))))))
Status of the listener
------------------------ Alias Listener2
Version TNSLSNR for Dec OSF / 1 AXP: Version 8.1.7.0.0 - Production
Start date 22-oct-2002 13:36:14
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level Off
Security off
SNMP OFF
Listener parameter file /u01/oracle/orahome1/neetwork/admin/listener.ora
Listener log file /u01/oracle/orahome1/neetwork/log/listener2.log
Services Summary ...
New2 HAS 1 Service Handler (S)
THE Command Complated SuccessFully
LSNRCTL> EXIT
Oracle @ SCE>
============================================================================================================================================================================================================= ==================
====================== This is not to do ======================== ===========
============================================================================================================================================================================================================= ==================
Eight, use initnew2.ora to come nomount database
Oracle @ SCE> Oracle_sid = new2; export oracle_sid
Oracle @ SCE> SQLPLUS / NOLOG
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:26:39 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
SQL> CONN INTERNAL
Connected to an idle instance.sql> Startup Nomount Pfile = / u01 / oracle / backup2 / initnew2.ora
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
SQL>
============================================================================================================================================================================================================= ==================
========================= 下 照 = ========================= =========================
============================================================================================================================================================================================================= ==================
Nine, with Backup ControlFile to TRACE backup control files on the main database
(Ie, create a tracking file for the control file. This is for the control file for the new database later)
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> SQLPLUS INTERNAL
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 13:36:58 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Productionsql> ALTER DATABASE Backup ControlFile to Trace;
Database altered.
SQL> EXIT
Disconnected from Oracle8i Release 8.1.7.0.0 - Production
Jserver Release 8.1.7.0.0 - Production
Oracle @ SCE>
Ten, edit the tracking file, save it as a SQL script (ready to create a trace file for new database)
Pay attention to 3 places:
(1). SET DATABASE "New2" Resetlogs
(2). Logfile
Group 1 '/u01/oracle/backup2/redo01.log' size 500K,
Group 2 '/u01/oracle/backup2/redo02.log' size 500k,
Group 3 '/u01/oracle/backup2/redo03.log' size 500K
(3). DataFile
'/u01/oracle/backup2/system01.dbf',
'/u01/oracle/backup2/tools01.dbf',
'/u01/oracle/backup2/rbs01.dbf',
'/u01/oracle/backup2/temp01.dbf',
'/u01/oracle/backup2/Users01.dbf',
'/u01/oracle/backup2/indx01.dbf',
'/u01/oracle/backup2/drsys01.dbf',
'/u01/oracle/backup2/lunar01.dbf'
The script for creating a new control file is as follows:
Create ControlFile Set Database "New2" ResetLogs ArchiveLog
MaxLogfiles 32
MaxLogmembers 2
MaxDatafiles 254
MaxInstances 8
MaxLoghistory 3630
Logfile
Group 1 '/u01/oracle/backup2/redo01.log' size 500K,
Group 2 '/u01/oracle/backup2/redo02.log' size 500k,
Group 3 '/u01/oracle/backup2/redo03.log' size 500K
DataFile
'/u01/oracle/backup2/system01.dbf',
'/u01/oracle/backup2/tools01.dbf',
'/u01/oracle/backup2/rbs01.dbf',
'/u01/oracle/backup2/temp01.dbf',
'/u01/oracle/backup2/Users01.dbf',
'/u01/oracle/backup2/indx01.dbf',
'/u01/oracle/backup2/drsys01.dbf',
'/u01/oracle/backup2/lunar01.dbf'
Character set US7ASCII
;
11. Execute this script, create a control file
============================================================================================================================================================================================================= ======================================== this is not ====== ==============================
============================================================================================================================================================================================================= ==================
(1). Modify Initnew.ora, re-specify the name of the control file
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
Control_files = ("/u01/oracle/backup2/control01.ctl")
============================================================================================================================================================================================================= ==================
It has been proven that if you don't do this, you will make an error below:
Do it in the eleventh step (4), it will be wrong
SQL> @ / u01 / oracle / back_script / ora_1381.sql
Create ControlFile Set Database "New2" ResetLogs ArchiveLog
*
Error At Line 1:
ORA-01503: Create ControlFile Failed
ORA-00200: ControlFile Could Not Be createdora-00202: controlfile: '/u01/oracle/backup2/controlfile01.ctl'
ORA-27038: SKGFRCRE: File EXISTS
SQL>
If an error, you will return from this step back from this step.
============================================================================================================================================================================================================= ==================
========================= 下 照 = ========================= =========================
============================================================================================================================================================================================================= ==================
(2). Set Oracle_SID = New2
Oracle @ SCE> Oracle_sid = new2; export oracle_sid
(3). With pfile = / u01 / oracle / backup2 / initnew2.ora to Nomount database
Oracle @ SCE> SQLPLUS / NOLOG
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 08:26:39 2002
(c) CopyRight 2000 Oracle Corporation. All Rights Reserved.
SQL> CONN INTERNAL
Connected to an iDLE Instance.
SQL> Startup Nomount Pfile = / u01 / oracle / backup2 / initnew2.ora
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
SQL>
OK is a new database
SQL> Host
$ ENV | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = new2
$ EXIT
SQL>
(4). Execute the script of the creation control file
SQL> @ / u01 / oracle / back_script / ora_9413.sql
Control File Created.
SQL>
This step is performed, and the database will create a control file in the location specified in Initnew2.ora.
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
Control_files = ("/u01/oracle/backup2/control01.ctl")
SQL> Host
$ CD / U01 / Oracle / Backup2
$ ls
$
It can be seen that Control01.ctl has been created
(6). SHUTDOWN database
SQL> Shutdown Immediate
ORA-01109: Database Not Open
Database dismount.
Oracle Instance Shut Down.
SQL>
============================================================================================================================================================================================================= ==================
====================== This is not to do ======================== ===========
============================================================================================================================================================================================================= ==================
(7). Modify the location and name of the control file in the initnew2.ora
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
#Control_files = ("/u01/oracle/backup2/control01.ctl")
Control_files = ("/u01/oracle/backup2/control02.ctl")
============================================================================================================================================================================================================= ==================
========================= 下 照 = ========================= =========================
============================================================================================================================================================================================================= ==================
(8). Re-nomount pfile = / u01 / oracle / backup2 / initnew2.ora
$ EXIT
SQL> Startup Nomount Pfile = / u01 / oracle / backup2 / initnew2.ora
Oracle Instance Started.
Total System Global Area 241939428 Bytes
FIXED SIZE 103396 BYTES
Variable size 82542592 bytes
Database buffers 159113216 BYTES
Redo buffers 180224 BYTES
SQL>
============================================================================================================================================================================================================= ======================================== this is not ====== ==============================
============================================================================================================================================================================================================= ==================
(9). Execute the script that creates control files again
SQL> @ / u01 / oracle / back_script2 / ora_9413.sql
Cluster altered.
SQL>
This step is performed, and the database will create a control file in the location specified in Initnew.ora.
#Control_files = ("/u01/oracle/backup2/controlfile01.ctl")
#Control_files = ("/u01/oracle/backup2/control01.ctl")
Control_files = ("/u01/oracle/backup2/control02.ctl")
SQL> Host
$ CD / U01 / Oracle / Backup2
$ ls
$
It can be seen that Control02.ctl has been created
12. Restore databases (with auto)
$ EXIT
============================================================================================================================================================================================================= ==================================================================================================================================================================== =================================================================================================================================================================================
============================================================================================================================================================================================================= ==================
SQL> ALTABASE MOUNT;
Database altered.
SQL>
SQL> Recover Database Using Backup ControlFile;
ORA-00279: Change 557654 generated at 10/22/2002 13:27:13 Needed for thread 1
ORA-00289: Suggestion: /u01/oracle/backup2/Arch/arch_1_2778.arc
ORA-00280: Change 557654 for thread 1 is in sequence # 2778
Specify log: {
Auto ------------ Knock "Auto"
ORA-00279: Change 557671 Generated at 10/22/2002 13:29:34 Needed for Thread 1
ORA-00289: Suggestion: /u01/oracle/backup2/Arch/arch_1_2779.arc
ORA-00280: Change 557671 for thread 1 is in sequence # 2779
ORA-00278: log file '/u01/oracle/backup2/Arch/arch_1_2778.arc' no longer neededfor this recovery
ORA-00308: Cannot Open Archived log '/u01/oracle/backup2/ArCh/arch_1_2779.arc'
ORA-27037: UNABLE TO OBTAIN FILE STATUS
Compaq Tru64 Unix Error: 2: No Such File or Directory
AdditionAl Information: 3
SQL>
Thirteen, recover again (with Cancel)
Compare the "After Switch Log" in the front hot spare value day, make sure that all the logs have been restored:
After Switch log, The Ending Archive log number is:
Database log mode archive mode
Automatic archival enabled
Archive Destination / U01 / Oracle / Admin / SCEDB / ARCH
Oldest Online Log Sequence 2777
Next log sequence to archive 2779
Current log sequence 2779
The current 2779, then recovered to 2778, taking the "Cancel" when the prompt 2779
SQL> Recover Database Use Backup ControlFile Until Cancel;
ORA-00279: Change 557671 Generated at 10/22/2002 13:29:34 Needed for Thread 1
ORA-00289: Suggestion: /u01/oracle/backup2/Arch/arch_1_2779.arc
ORA-00280: Change 557671 for thread 1 is in sequence # 2779
Specify log: {
Cancel ------------ Knock "Cancel"
Media recovery canceled.
SQL>
14, open the database with Open ResetLogs
This step has established the Redo Log file specified in Initnew.ora and opens the database.
SQL> ALTER DATABASE OPEN RESETLOGS;
Database altered.
SQL>
Fifteen, verify that the data is restored
For convenience, you can open a session (window),
And set Oracle_SID = SCEDB; Export Oracle_sid
Then open the old database, and the new database is compared.
In the window (old database):
Oracle @ SCE> Oracle_SID = SCEDB; Export Oracle_sid
Oracle @ SCE> Env | GREP ORACLE
Oracle_base = / u01 / oracle
Oracle_home = / u01 / oracle / orahome1
Oracle_sid = SCEDB
Oracle @ SCE> SQLPlus Lunar / Lunar
SQL * Plus: Release 8.1.7.0.0 - Production on Tue Oct 22 12:47:23 2002 (C) Copyright 2000 Oracle Corporation. All Rights Reserved.
Connected to:
Oracle8i Release 8.1.7.0.0 - PRODUCTION
Jserver Release 8.1.7.0.0 - Production
SQL> SELECT *.
A
------------
1
2
3
SQL>
In the window 2 (new database):
SQL> Conn Lunar / Lunar
Connected.
SQL> SELECT *.
A
------------
1
2
SQL>
Verified the database except for Redo's no reply, all of the files that archived
(Refer to the initial assumption:
So far, there are 2 archives in the table TEST of the user, ie 1 and 2.
There is also an unsubmitted in REDO, ie 3;
Now you are hot in the new window (SQLUS Internal), the current Archive log is 2777,
Note that the Archive log after the hot standby is observed, and record it to control the data reply.
)
Conclusion: This thermal backup is backup for valid database