2017100001124.pdf use seed_database.dfband seed_database.ctlto create a database .txt manually,
Using seed_database.dfband seed_database.ctlto create a database .txt
-- // Read the post of yueli34 yesterday at http://www.itpub.net/thread-2094530-1-1.html. The annotations are linked with the instructions. Thank you for the yueli34operation prompt.
-- // Test it by yourself:
1. Create a parameter file
-- // Create a parameter file. The directory is $ ORACLE_HOME/dbs:
$ Cat/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initseeddata. ora
Db_name = seeddata
Sga_target = 1024 M
Control_files =/u01/app/oracle/oradata/ora11g/control01.ctl
Compatible = 11.2.0.4
$ Mkdir-p/u01/app/oracle/oradata/ora11g/
-- // Start to nomount for verification
$ Export ORACLE_SID = seeddata
SYS @ seeddata> startup nomount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 297796488 bytes
Database Buffers 759169024 bytes
Redo Buffers 9711616 bytes
2. Create a control file
$ Cd $ ORACLE_HOME/assistants/dbca/templates
$ Ls $ ORACLE_HOME/assistants/dbca/templates-l
Total 301856
-Rw-r -- 1 oracle oinstall 5104 12:08:38 Data_Warehouse.dbc
-Rwxr-xr-x 1 oracle oinstall 21741568 11:12:03 example01.dfb
-Rwxr-xr-x 1 oracle oinstall 1507328 11:12:03 example. dmp
-Rw-r -- 1 oracle oinstall 4984 12:08:44 General_Purpose.dbc
-Rw-r -- 1 oracle oinstall 11489 08:24:26 New_Database.dbt
-Rwxr-xr-x 1 oracle oinstall 9748480 11:11:15 Seed_Database.ctl
-Rwxr-xr-x 1 oracle oinstall 275750912 11:11:15 Seed_Database.dfb
$ Cp $ ORACLE_HOME/assistants/dbca/templates/Seed_Database.ctl/u01/app/oracle/oradata/ora11g/control01.ctl
$ Ls-l/u01/app/oracle/oradata/ora11g/control01.ctl
-Rwxr-xr-x 1 oracle oinstall 9748480 10:43:13/u01/app/oracle/oradata/ora11g/control01.ctl
-- // Start to the mount status for verification:
SYS @ seeddata> alter database mount;
Database altered.
-- // Process the log file path. The path of the log file in the control file is:
SYS @ seeddata >@& r/logfile
GROUP # status type member IS_REC GROUP # THREAD # SEQUENCE # bytes blocksize members archiv status FIRST_CHANGE # FIRST_TIME NEXT_CHANGE # NEXT_TIME
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 ONLINE/ade/B/2232964209/oracle/oradata/seeddata/redo01.log NO 1 1 70 52428800 512 1 NO INACTIVE 889458 12:03:35 894960 12:03:36
2 ONLINE/ade/B/2232964209/oracle/oradata/seeddata/redo02.log NO 2 1 71 52428800 512 1 NO INACTIVE 894960 12:03:36 920281 12:04:15
3 ONLINE/ade/B/2232964209/oracle/oradata/seeddata/redo03.log NO 3 1 72 52428800 512 1 NO CURRENT 920281 12:04:15 2.814750E + 14
-- // Is a non-existent path. rename is required to the/u01/app/oracle/oradata/ora11g/path.
Alter database rename file '/ade/B/2232964209/oracle/oradata/seeddata/redo01.log' to '/u01/app/oracle/oradata/ora11g/redo01.log ';
Alter database rename file '/ade/B/2232964209/oracle/oradata/seeddata/redo02.log' to '/u01/app/oracle/oradata/ora11g/redo02.log ';
Alter database rename file '/ade/B/2232964209/oracle/oradata/seeddata/redo03.log' to '/u01/app/oracle/oradata/ora11g/redo03.log ';
SYS @ seeddata >@& r/logfile
GROUP # status type member IS_REC GROUP # THREAD # SEQUENCE # bytes blocksize members archiv status FIRST_CHANGE # FIRST_TIME NEXT_CHANGE # NEXT_TIME
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 ONLINE/u01/app/oracle/oradata/ora11g/redo01.log NO 1 1 70 52428800 512 1 no inactive 889458 12:03:35 894960 12:03:36
2 ONLINE/u01/app/oracle/oradata/ora11g/redo02.log NO 2 1 71 52428800 512 1 no inactive 894960 12:03:36 920281 12:04:15
3 ONLINE/u01/app/oracle/oradata/ora11g/redo03.log NO 3 1 72 52428800 512 1 no current 920281 12:04:15 2.814750E + 14
-- OK.
3. Register a data file backup set
-- // Register the backup set Seed_Database.dfb:
RMAN> catalog start with '$ ORACLE_HOME/assistants/dbca/templates/Seed_Database.dfb ';
Searching for all files that match the pattern $ ORACLE_HOME/assistants/dbca/templates/Seed_Database.dfb
List of Files Unknown to the Database
============================================
File Name:/u01/app/oracle/product/11.2.0.4/dbhome_1/assistants/dbca/templates/Seed_Database.dfb
Do you really want to catalog the above files (enter YES or NO )? Yes
Cataloging files...
Cataloging done
List of Cataloged Files
======================================
File Name:/u01/app/oracle/product/11.2.0.4/dbhome_1/assistants/dbca/templates/Seed_Database.dfb
-- // View the backup set. You can see that the same backup set has two copies. One is the original control file, and the other is the newly registered catalog. The original one does not actually exist.
-- //, Which can be removed through crosscheck and delete.
RMAN> list backup;
List of Backup Sets
==============================
BS Key Type LV Size
-----------------------
1 Full 262.97 M
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
-------------------------------------------
1 Full 925701 12:07:43/ade/B/2232964209/oracle/oradata/seeddata/system01.dbf
2 Full 925701 12:07:43/ade/B/2232964209/oracle/oradata/seeddata/sysaux01.dbf
3 Full 925701 12:07:43/ade/B/2232964209/oracle/oradata/seeddata/undotbs01.dbf
4 Full 925701 12:07:43/ade/B/2232964209/oracle/oradata/seeddata/users01.dbf
Backup Set Copy #1 of backup set 1
Device Type Elapsed Time Completion Time Compressed Tag
-------------------------------------------------------
DISK 00:00:31 12:08:24 YES
List of Backup Pieces for backup set 1 Copy #1
BP Key Pc # Status Piece Name
-------------------------------
1 1 AVAILABLE/ade/B/2232964209/oracle/oradata/Seed_Database.dfb
Backup Set Copy #2 of backup set 1
Device Type Elapsed Time Completion Time Compressed Tag
-------------------------------------------------------
DISK 00:00:31 2017-11-23 10:47:42 YES
List of Backup Pieces for backup set 1 Copy #2
BP Key Pc # Status Piece Name
-------------------------------
2 1 AVAILABLE/u01/app/oracle/product/11.2.0.4/dbhome_1/assistants/dbca/templates/Seed_Database.dfb
-- // Checksum and delete expired backup
-- // RMAN> crosscheck backup;
RMAN> crosscheck backup;
Using channel ORA_DISK_1
Crosschecked backup piece: found to be 'expired'
Backup piece handle =/ade/B/2232964209/oracle/oradata/Seed_Database.dfb RECID = 1 STAMP = 824299673
Crosschecked backup piece: found to be 'available'
Backup piece handle =/u01/app/oracle/product/11.2.0.4/dbhome_1/assistants/dbca/templates/Seed_Database.dfb RECID = 2 STAMP = 960806862
Crosschecked 2 objects
-- // RMAN> delete expired backup;
RMAN> delete expired backup;
Using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc # Cp # Status Device Type Piece Name
----------------------------------------------------
1 1 1 1 expired disk/ade/B/2232964209/oracle/oradata/Seed_Database.dfb
Do you really want to delete the above objects (enter YES or NO )? Yes
Deleted backup piece
Backup piece handle =/ade/B/2232964209/oracle/oradata/Seed_Database.dfb RECID = 1 STAMP = 824299673
Deleted 1 EXPIRED objects
-- // The above steps do not need to be performed.
-- // Modify the data file path. I have annotated the recover database. Because there is no archive in this step, the write or write operations are the same.
Run {
Set newname for datafile 1 to '/u01/app/oracle/oradata/ora11g/system01.dbf ';
Set newname for datafile 2 to '/u01/app/oracle/oradata/ora11g/sysaux01.dbf ';
Set newname for datafile 3 to '/u01/app/oracle/oradata/ora11g/undotbs01.dbf ';
Set newname for datafile 4 to '/u01/app/oracle/oradata/ora11g/users01.dbf ';
Restore database;
Switch datafile all;
# Recover database;
}
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Starting restore at 10:49:53
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID = 1409 device type = DISK
Channel ORA_DISK_1: starting datafile backup set restore
Channel ORA_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_DISK_1: restoring datafile 00001 to/u01/app/oracle/oradata/ora11g/system01.dbf
Channel ORA_DISK_1: restoring datafile 00002 to/u01/app/oracle/oradata/ora11g/sysaux01.dbf
Channel ORA_DISK_1: restoring datafile 00003 to/u01/app/oracle/oradata/ora11g/undotbs01.dbf
Channel ORA_DISK_1: restoring datafile 00004 to/u01/app/oracle/oradata/ora11g/users01.dbf
Channel ORA_DISK_1: reading from backup piece/ade/B/2232964209/oracle/oradata/Seed_Database.dfb
Channel ORA_DISK_1: errors found reading piece handle =/ade/B/2232964209/oracle/oradata/Seed_Database.dfb
Channel ORA_DISK_1: failover to piece handle =/u01/app/oracle/product/11.2.0.4/dbhome_1/assistants/dbca/templates/Seed_Database.dfb tag = NULL
Channel ORA_DISK_1: restored backup piece 1
Channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 10:50:39
Datafile 1 switched to datafile copy
Input datafile copy RECID = 5 STAMP = 960807039 file name =/u01/app/oracle/oradata/ora11g/system01.dbf
Datafile 2 switched to datafile copy
Input datafile copy RECID = 6 STAMP = 960807039 file name =/u01/app/oracle/oradata/ora11g/sysaux01.dbf
Datafile 3 switched to datafile copy
Input datafile copy RECID = 7 STAMP = 960807039 file name =/u01/app/oracle/oradata/ora11g/undotbs01.dbf
Datafile 4 switched to datafile copy
Input datafile copy RECID = 8 STAMP = 960807039 file name =/u01/app/oracle/oradata/ora11g/users01.dbf
Starting recover at 10:50:39
Using channel ORA_DISK_1
Starting media recovery
RMAN-08187: WARNING: media recovery until SCN 925701 complete
Finished recover at 10:50:41
3. Open the database:
SYS @ seeddata> alter database open read only;
Database altered.
-- // Test whether open read only can be opened.
SYS @ seeddata> alter database open;
Alter database open
*
ERROR at line 1:
The ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SYS @ seeddata> alter database open NORESETLOGS;
Alter database open NORESETLOGS
*
ERROR at line 1:
ORA-01588: must use RESETLOGS option for database open
SYS @ seeddata> select CONTROLFILE_TYPE from v $ database;
CONTROLFILE_TY
--------------
BACKUP
4. try to create a new control file:
SYS @ seeddata> alter database backup controlfile to trace;
Database altered.
$ Cat cc.txt
STARTUP NOMOUNT
Create controlfile reuse database "SEEDDATA" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/u01/app/oracle/oradata/ora11g/redo01.log 'SIZE 50 m blocksize 512,
GROUP 2 '/u01/app/oracle/oradata/ora11g/redo02.log' SIZE 50 m blocksize 512,
GROUP 3 '/u01/app/oracle/oradata/ora11g/redo03.log' SIZE 50 m blocksize 512
-- STANDBY LOGFILE
DATAFILE
'/U01/app/oracle/oradata/ora11g/system01.dbf ',
'/U01/app/oracle/oradata/ora11g/sysaux01.dbf ',
'/U01/app/oracle/oradata/ora11g/undotbs01.dbf ',
'/U01/app/oracle/oradata/ora11g/users01.dbf'
Character set US7ASCII
;
-- // Note that the database character set installed in this way is US7ASCII, which is a subset of all character sets.
SYS @ seeddata> @/tmp/cc.txt
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 297796488 bytes
Database Buffers 759169024 bytes
Redo Buffers 9711616 bytes
Create controlfile reuse database "SEEDDATA" NORESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: create controlfile failed
ORA-01192: must have at least one enabled thread
$ Oerr ora 1, 01192
01192,000 00, "must have at least one enabled thread"
// * Cause: You must specify at least two logfiles from at least one thread
// At the create contolfile command line.
// * Action: Find the missing logfiles and resubmit the command with the newly
// Found logfiles encoded in the command line.
-- // Restart !!
SYS @ seeddata> alter database clear logfile group 1;
Database altered.
SYS @ seeddata> alter database clear logfile group 2;
Database altered.
SYS @ seeddata> alter database clear logfile group 3;
Database altered.
-- // Still does not work.
-- // Install some articles and prompt that the created control file can only be RESETLOGS.
SYS @ seeddata> alter database open RESETLOGS;
Database altered.
-- // Close the database and recreate the control file OK.
SYS @ seeddata> @/tmp/cc.txt
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 297796488 bytes
Database Buffers 759169024 bytes
Redo Buffers 9711616 bytes
Control file created.
SYS @ seeddata> alter database open;
Database altered.
RMAN> list incarnation;
Using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name db id status Reset SCN Reset Time
-------------------------------------------------------------
1 1 SEEDDATA 4152976186 CURRENT 925702 11:43:14
5. supplement the establishment of temporary files:
Alter tablespace temp add tempfile '/u01/app/oracle/oradata/ora11g/temp01.dbf' REUSE;
-- // Create an error in this way.
$ Touch/u01/app/oracle/oradata/ora11g/temp01.dbf
SYS @ seeddata> alter tablespace temp add tempfile '/u01/app/oracle/oradata/ora11g/temp01.dbf' size 100 m REUSE;
Tablespace altered.
6. yueli34 wants to enable the NORESETLOGS to open the database, and the original control file itself is of the Backup Type. If it can be modified to the current one, it is estimated that it can.
SYS @ seeddata> select CONTROLFILE_TYPE from v $ database;
CONTROLFILE_TY
--------------
BACKUP