Вы находитесь на странице: 1из 7

General Information

Current
Control
Files

colvalueformata41
SELECTvalue
FROMgv$parameter
WHEREname='control_files';
SELECTRPAD(SUBSTR(name,1,50),51,'')"CONTROLFILE
NAME"
FROMgv$controlfile;

Depen
GV_$CONTROLFI GV_$CONTROLFILE_RECORD_SEC
dent
LE
TION
Objects

Create Control File


Reuse
previou
sly
existing
control
file(s) if
they
exist

CREATECONTROLFILE[REUSE]
DATABASE<database_name>
<RESETLOGS|NORESETLOGS>;
STARTUPNOMOUNT;
CREATECONTROFILEREUSE
SETDATABASEorabase
RESETLOGS;
ALTERDATABASEOPENRESETLOGS;

Reuse
previou
sly
existing
control
file(s) if
they
exist

CREATECONTROLFILE[REUSE]
DATABASE<database_name>
<RESETLOGS|NORESETLOGS>;
STARTUPNOMOUNT;
CREATECONTROFILEREUSE
SETDATABASEorabase
NORESETLOGS;

Create Standby Control File


Create
Control
File For
Logical
Standb
y

ALTERDATABASECREATELOGICALSTANDBYCONTROLFILE
AS<file_name>REUSE;

Create
Control
File For
Physic

ALTERDATABASECREATEPHYSICALSTANDBYCONTROLFILE
AS<file_name>REUSE;

ALTERDATABASECREATELOGICALSTANDBYCONTROLFILE
AS'c:\oragrid\control03.ctl';

ALTERDATABASECREATEPHYSICALSTANDBYCONTROLFILE

al
Standb

AS'c:\oragrid\control03.ctl';

Move Control Files


Relocat
e
Control
Files

conn/assysdba
SQL>showparametercontrol
SQL>shutdownimmediate
SQL>createpfilefromspfile;
SQL>host
usecptocopythecontrolfilefromitscurrent
location
tothenewlocation
$cp$ORACLE_BASE/oradata/orabase/control02.ctl
/u02/oradata/orabase/control02.ctl
$vi$ORACLE_HOME/dbs/initorabase.ora
changethecontrolfilelocationtothenewlocation
savethechangesandexitvi
$exit
SQL>createspfilefrompfile;
startup
showparametercontrol
host
removethecopyofthecontrolfileintheoriginal
location
$rm$ORACLE_BASE/oradata/orabase/control02.ctl

Backup Control Files


Backup
Control
File To
Text
File

ALTERDATABASEBACKUPCONTROLFILETOTRACEAS
<file_name>REUSE<RESETLOGS|NORESETLOGS>
ALTERDATABASEBACKUPCONTROLFILETOTRACE;
ALTERDATABASEBACKUPCONTROLFILETOTRACEAS'c:

emp\control.bkp';
ALTERDATABASEBACKUPCONTROLFILETO
TRACEAS'/u01/control.bkp'REUSE;
ALTERDATABASEBACKUPCONTROLFILETOTRACEAS'c:
emp\control01.ctl'NORESETLOGS;
To
Binary
File

Sample
Backup
Control
File
Script
Output

ALTERDATABASEBACKUPCONTROLFILETO
'/u01/oradata/control.bkp';
ALTERDATABASEBACKUPCONTROLFILETO'c:
emp\control.bkp'REUSE;
ThefollowingarecurrentSystemscopeREDOLog
Archivalrelated
parametersandcanbeincludedinthedatabase
initializationfile.

LOG_ARCHIVE_DEST=''
LOG_ARCHIVE_DUPLEX_DEST=''

LOG_ARCHIVE_FORMAT=ARC%S_%R.%T

DB_UNIQUE_NAME="orabase"

LOG_ARCHIVE_CONFIG='SEND,RECEIVE,NODG_CONFIG'
LOG_ARCHIVE_MAX_PROCESSES=4
STANDBY_FILE_MANAGEMENT=MANUAL
STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
FAL_CLIENT=''
FAL_SERVER=''

LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
LOG_ARCHIVE_DEST_10='OPTIONALREOPEN=300NODELAY'
LOG_ARCHIVE_DEST_10='ARCHNOAFFIRMNOEXPEDITE
NOVERIFYSYNC'
LOG_ARCHIVE_DEST_10='REGISTERNOALTERNATE
NODEPENDENCY'
LOG_ARCHIVE_DEST_10='NOMAX_FAILURENOQUOTA_SIZE
NOQUOTA_USEDNODB_UNIQUE_NAME'

LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGF
ILES)'
LOG_ARCHIVE_DEST_STATE_10=ENABLE

BelowaretwosetsofSQLstatements,eachofwhich

createsanew
controlfileandusesittoopenthedatabase.The
firstsetopens
thedatabasewiththeNORESETLOGSoptionandshould
beusedonlyif
thecurrentversionsofallonlinelogsare
available.Thesecond
setopensthedatabasewiththeRESETLOGSoptionand
shouldbeused
ifonlinelogsareunavailable.
Theappropriatesetofstatementscanbecopiedfrom
thetraceinto
ascriptfile,editedasnecessary,andexecutedwhen
thereisa
needtorecreatethecontrolfile.

Set#1.NORESETLOGScase

Thefollowingcommandswillcreateanewcontrolfile
anduseit
toopenthedatabase.
DatausedbyRecoveryManagerwillbelost.
Additionallogsmayberequiredformediarecoveryof
offline
Usethisonlyifthecurrentversionsofallonline
logsare
available.
Aftermountingthecreatedcontrolfile,thefollowing
SQL
statementwillplacethedatabaseintheappropriate
protectionmode:
ALTERDATABASESETSTANDBYDATABASETOMAXIMIZE
PERFORMANCE
STARTUPNOMOUNT
CREATECONTROLFILEREUSEDATABASE"ORABASE"NORESETLOGS
NOARCHIVELOG
MAXLOGFILES16
MAXLOGMEMBERS3
MAXDATAFILES100
MAXINSTANCES8
MAXLOGHISTORY292
LOGFILE
GROUP1'C:\APP\ORACLE\ORADATA\ORABASE\REDO01.LOG'SIZE
50M,
GROUP2'C:\APP\ORACLE\ORADATA\ORABASE\REDO02.LOG'SIZE

50M,
GROUP3'C:\APP\ORACLE\ORADATA\ORABASE\REDO03.LOG'SIZE
50M
STANDBYLOGFILE
DATAFILE
'C:\APP\ORACLE\ORADATA\ORABASE\SYSTEM01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\SYSAUX01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\UNDOTBS01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\USERS01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\EXAMPLE01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\UWDATA01.DBF'
CHARACTERSETWE8MSWIN1252;
Commandstorecreateincarnationtable
BelowlognamesMUSTbechangedtoexistingfilenames
on
disk.Anyonelogfilefromeachbranchcanbeused
to
recreateincarnationrecords.
ALTERDATABASEREGISTERLOGFILE
'C:\APP\ORACLE\FLASH_RECOVERY_AREA\ORABASE\ARCHIVELOG9
_02_02\O1_MF_1_1_%U_.ARC';
ALTERDATABASEREGISTERLOGFILE
'C:\APP\ORACLE\FLASH_RECOVERY_AREA\ORABASE\ARCHIVELOG9
_02_02\O1_MF_1_1_%U_.ARC';
Recoveryisrequiredifanyofthedatafilesare
restoredbackups,
orifthelastshutdownwasnotnormalorimmediate.
RECOVERDATABASE
Databasecannowbeopenednormally.
ALTERDATABASEOPEN;
Commandstoaddtempfilestotemporarytablespaces.
Onlinetempfileshavecompletespaceinformation.
Othertempfilesmayrequireadjustment.
ALTERTABLESPACETEMPADDTEMPFILE
'C:\APP\ORACLE\ORADATA\ORABASE\TEMP01.DBF'
SIZE20971520REUSEAUTOEXTENDONNEXT655360MAXSIZE
32767M;
Endoftempfileadditions.

Set#2.RESETLOGScase

Thefollowingcommandswillcreateanewcontrolfile
anduseit

toopenthedatabase.
DatausedbyRecoveryManagerwillbelost.
Thecontentsofonlinelogswillbelostandall
backupswill
beinvalidated.Usethisonlyifonlinelogsare
damaged.
Aftermountingthecreatedcontrolfile,thefollowing
SQL
statementwillplacethedatabaseintheappropriate
protectionmode:
ALTERDATABASESETSTANDBYDATABASETOMAXIMIZE
PERFORMANCE
STARTUPNOMOUNT
CREATECONTROLFILEREUSEDATABASE"ORABASE"RESETLOGS
NOARCHIVELOG
MAXLOGFILES16
MAXLOGMEMBERS3
MAXDATAFILES100
MAXINSTANCES8
MAXLOGHISTORY292
LOGFILE
GROUP1'C:\APP\ORACLE\ORADATA\ORABASE\REDO01.LOG'SIZE
50M,
GROUP2'C:\APP\ORACLE\ORADATA\ORABASE\REDO02.LOG'SIZE
50M,
GROUP3'C:\APP\ORACLE\ORADATA\ORABASE\REDO03.LOG'SIZE
50M
STANDBYLOGFILE
DATAFILE
'C:\APP\ORACLE\ORADATA\ORABASE\SYSTEM01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\SYSAUX01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\UNDOTBS01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\USERS01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\EXAMPLE01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\UWDATA01.DBF'
CHARACTERSETWE8MSWIN1252;
Commandstorecreateincarnationtable
BelowlognamesMUSTbechangedtoexistingfilenames
on
disk.Anyonelogfilefromeachbranchcanbeused
to
recreateincarnationrecords.
ALTERDATABASEREGISTERLOGFILE

'C:\APP\ORACLE\FLASH_RECOVERY_AREA\ORABASE\ARCHIVELOG9
_02_02\O1_MF_1_1_%U_.ARC';
ALTERDATABASEREGISTERLOGFILE
'C:\APP\ORACLE\FLASH_RECOVERY_AREA\ORABASE\ARCHIVELOG9
_02_02\O1_MF_1_1_%U_.ARC';
Recoveryisrequiredifanyofthedatafilesare
restoredbackups,
orifthelastshutdownwasnotnormalorimmediate.
RECOVERDATABASEUSINGBACKUPCONTROLFILE
Databasecannowbeopenedzeroingtheonlinelogs.
ALTERDATABASEOPENRESETLOGS;
Commandstoaddtempfilestotemporarytablespaces.
Onlinetempfileshavecompletespaceinformation.
Othertempfilesmayrequireadjustment.
ALTERTABLESPACETEMPADDTEMPFILE
'C:\APP\ORACLE\ORADATA\ORABASE\TEMP01.DBF'
SIZE20971520REUSEAUTOEXTENDONNEXT655360MAXSIZE
32767M;
Endoftempfileadditions.

Вам также может понравиться