Oracle's use of Controlfile trace files to reconstruct control files

Source: Internet
Author: User

One, 11g RAC rebuild control file

1.---"Create Controlfile" command is generated into the trace file:
ALTER DATABASE backup Controlfile to trace;

2.--Confirm the path of the trace file:
Sql> Select value from V$diag_info where Name= ' Default Trace File ';

3.---The Intercept script finds and executes the noresetlogs version of the "Create Controlfile" command in the trace file to End of tempfile additions.

As follows:
--Set #1. Noresetlogs case
--
--The following commands would create a new control file and use it
-To open the database.
--Data used by Recovery Manager would be lost.
--Additional logs May is required for media recovery of offline
--Use the If the current versions of all online logs is
--Available.
--After mounting the created Controlfile, the following SQL
--statement'll place, the database in the appropriate
--Protection mode:
--ALTER database SET STANDBY database to maximize performance
STARTUP Nomount
CREATE controlfile Reuse DATABASE "Yndss" Noresetlogs Noarchivelog
Maxlogfiles 192
Maxlogmembers 3
Maxdatafiles 2560
Maxinstances 32
Maxloghistory 292
LOGFILE
GROUP 1 (
' +data01/yndss/onlinelog/group_1.257.954170283 ',
' +fra/yndss/onlinelog/group_1.257.954170289 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 2 (
' +data01/yndss/onlinelog/group_2.258.954170295 ',
' +fra/yndss/onlinelog/group_2.258.954170301 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 3 (
' +data01/yndss/onlinelog/group_3.259.954170307 ',
' +fra/yndss/onlinelog/group_3.259.954170313 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 4 (
' +data01/yndss/onlinelog/group_4.260.954170317 ',
' +fra/yndss/onlinelog/group_4.260.954170323 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 5 (
' +data01/yndss/onlinelog/group_5.267.954172379 ',
' +fra/yndss/onlinelog/group_5.261.954172383 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 6 (
' +data01/yndss/onlinelog/group_6.268.954172389 ',
' +fra/yndss/onlinelog/group_6.262.954172395 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 7 (
' +data01/yndss/onlinelog/group_7.269.954172399 ',
' +fra/yndss/onlinelog/group_7.263.954172405 '
) SIZE 4096M BLOCKSIZE 512,
GROUP 8 (
' +data01/yndss/onlinelog/group_8.270.954172411 ',
' +fra/yndss/onlinelog/group_8.264.954172417 '
) SIZE 4096M BLOCKSIZE 512
--STANDBY LOGFILE
DataFile
' +data01/yndss/datafile/system.261.954170329 ',
' +data01/yndss/datafile/sysaux.262.954170337 ',
' +data01/yndss/datafile/undotbs1.263.954170349 ',
' +data01/yndss/datafile/undotbs2.265.954170389 ',
' +data01/yndss/datafile/users.266.954170413 ',
' +data01/yndss/datafile/etl001.dbf ',
' +data01/yndss/datafile/src001.dbf ',
' +data01/yndss/datafile/cdr001.dbf ',
' +data01/yndss/datafile/day001.dbf ',
' +data01/yndss/datafile/mon001.dbf ',
' +data01/yndss/datafile/detail001.dbf ',
' +data01/yndss/datafile/code001.dbf ',
' +data01/yndss/datafile/dss001.dbf ',
' +data01/yndss/datafile/dm001.dbf ',
' +data01/yndss/datafile/rpt001.dbf ',
' +data01/yndss/datafile/undotbs1.292.954498057 ',
' +data01/yndss/datafile/undotbs2.293.954498139 ',
' +data01/yndss/datafile/day002 ',
' +data01/yndss/datafile/day004 ',
' +data01/yndss/datafile/day005 ',
' +data01/yndss/datafile/day006 ',
' +data01/yndss/datafile/day007 ',
' +data01/yndss/datafile/day008 ',
' +data01/yndss/datafile/day009 ',
' +data01/yndss/datafile/day010 ',
' +data01/yndss/datafile/day011 ',
' +data01/yndss/datafile/day012 ',
' +data01/yndss/datafile/day013 ',
' +data01/yndss/datafile/day014 ',
' +data01/yndss/datafile/day015 ',
' +data01/yndss/datafile/day016 ',
' +data01/yndss/datafile/day017 ',
' +data01/yndss/datafile/day018 ',
' +data01/yndss/datafile/day019 ',
' +data01/yndss/datafile/day020 ',
' +data01/yndss/datafile/day021 ',
' +data01/yndss/datafile/day022 ',
' +data01/yndss/datafile/day023 '
CHARACTER SET ZHS16GBK
;
--Commands to re-create incarnation table
--Below log names must is changed to existing filenames on
--disk. Any one log file from each branch can is used to
--Re-create incarnation records.
-ALTER DATABASE REGISTER LOGFILE ' +fra ';
--Recovery is required if any of the datafiles is restored backups,
--or if the last shutdown is not normal or immediate.
RECOVER DATABASE
--Database can now is opened normally.
ALTER DATABASE OPEN;
--Commands to add tempfiles to temporary tablespaces.
--Online Tempfiles has complete space information.
--Other tempfiles may require adjustment.
ALTER tablespace TEMP ADD tempfile ' +data01/yndss/tempfile/temp.264.954170377 '
SIZE 20480M Reuse autoextend on NEXT 655360 MAXSIZE 131071M;
ALTER tablespace TEMP01 ADD tempfile ' +data01/yndss/tempfile/temp01.272.954431201 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP01 ADD tempfile ' +data01/yndss/tempfile/temp01.273.954431229 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP01 ADD tempfile ' +data01/yndss/tempfile/temp01.274.954431245 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP01 ADD tempfile ' +data01/yndss/tempfile/temp01.275.954431255 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP01 ADD tempfile ' +data01/yndss/tempfile/temp01.276.954431265 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP02 ADD tempfile ' +data01/yndss/tempfile/temp02.277.954431307 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP02 ADD tempfile ' +data01/yndss/tempfile/temp02.278.954431321 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP02 ADD tempfile ' +data01/yndss/tempfile/temp02.279.954431347 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP02 ADD tempfile ' +data01/yndss/tempfile/temp02.280.954431371 '
SIZE 30720M reuse Autoextend OFF;
ALTER tablespace TEMP02 ADD tempfile ' +data01/yndss/tempfile/temp02.281.954431381 '
SIZE 30720M reuse Autoextend OFF;
--End of tempfile additions.

Description: Reuse can reuse temporary files that already exist in the database itself

4 、--Formal reconstruction (can be CP backup control file before rebuilding)
Alter system set CLUSTER_DATABASE=FALSE scope=spfile sid= ' * ';
@ Script
Alter system set Cluster_database=true scope=spfile sid= ' * ';

Note: If the environment is a cluster, you need to adjust the cluster_database parameter.
——————————————————————————————

Second, 12c reconstruction control file

STARTUP Nomount
CREATE controlfile Reuse DATABASE "ORCL" Noresetlogs Noarchivelog
Maxlogfiles 16
Maxlogmembers 3
Maxdatafiles 1024
Maxinstances 8
Maxloghistory 292
LOGFILE
GROUP 1 '/home/oracle/app/oradata/orcl/redo01.log ' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/home/oracle/app/oradata/orcl/redo02.log ' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/home/oracle/app/oradata/orcl/redo03.log ' SIZE 50M BLOCKSIZE 512
DataFile
'/home/oracle/app/oradata/orcl/system01.dbf ',
'/home/oracle/app/oradata/orcl/sysaux01.dbf ',
'/home/oracle/app/oradata/orcl/undotbs01.dbf ',
'/home/oracle/app/oradata/orcl/pdbseed/system01.dbf ',
'/home/oracle/app/oradata/orcl/users01.dbf ',
'/home/oracle/app/oradata/orcl/pdbseed/sysaux01.dbf ',
'/home/oracle/app/oradata/orcl/pdb/system01.dbf ',
'/home/oracle/app/oradata/orcl/pdb/sysaux01.dbf ',
'/HOME/ORACLE/APP/ORADATA/ORCL/PDB/PDB_USERS01.DBF '
CHARACTER SET ZHS16GBK
;
RECOVER DATABASE
ALTER DATABASE OPEN;
ALTER pluggable DATABASE all OPEN;
ALTER tablespace TEMP ADD tempfile '/home/oracle/app/oradata/orcl/temp01.dbf '
SIZE 92274688 Reuse autoextend on NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = pdb$seed;
ALTER tablespace TEMP ADD tempfile '/home/oracle/app/oradata/orcl/pdbseed/pdbseed_temp01.dbf '
SIZE 91226112 Reuse autoextend on NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB;
ALTER tablespace TEMP ADD tempfile '/home/oracle/app/oradata/orcl/pdb/temp01.dbf '
SIZE 20971520 Reuse autoextend on NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = cdb$root;

——————————————————————————————

Add:
If necessary, use the strings command to locate the data file and the online log path

Oracle's use of Controlfile trace files to reconstruct control files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.