当前位置:  数据库>oracle

Oracle 控制文件 说明

    来源: 互联网  发布时间:2017-05-20

    本文导语: 一. Oracle 控制文件内容   我们可以通过v$controlfile_record_section 视图查看控制文件里包含的内容。   SQL> select type from v$controlfile_record_section;   TYPE -------------------------------------------------------- DATABASE CKPT PROGRESS REDO THREAD REDO LOG DATAFILE ...

一. Oracle 控制文件内容

 

我们可以通过v$controlfile_record_section 视图查看控制文件里包含的内容。

 

SQL> select type from v$controlfile_record_section;

 

TYPE

--------------------------------------------------------

DATABASE

CKPT PROGRESS

REDO THREAD

REDO LOG

DATAFILE

FILENAME

TABLESPACE

TEMPORARY FILENAME

RMAN CONFIGURATION

LOG HISTORY

OFFLINE RANGE

ARCHIVED LOG

BACKUP SET

BACKUP PIECE

BACKUP DATAFILE

BACKUP REDOLOG

DATAFILE COPY

BACKUP CORRUPTION

COPY CORRUPTION

DELETED OBJECT

PROXY COPY

BACKUP SPFILE

DATABASE INCARNATION

FLASHBACK LOG

RECOVERY DESTINATION

INSTANCE SPACE RESERVATION

REMOVABLE RECOVERY FILES

RMAN STATUS

THREAD INSTANCE NAME MAPPING

MTTR

DATAFILE HISTORY

STANDBY DATABASE MATRIX

GUARANTEED RESTORE POINT

RESTORE POINT

DATABASE BLOCK CORRUPTION

ACM OPERATION

FOREIGN ARCHIVED LOG

 

37 rows selected.

 

二. 可以通过dump看到控制文件内

2.1 直接dump controlfile

alter system set events'immediate trace name controlf level 10'

 

2.2. 使用alter database backup controlfile to filename

 

以上两种方法生成的dump文件是不可读的即乱码。 只有生成trace后,才是可读的。

 

2.2. 使用alter database backup controlfile to trace

生成的trace 文件在udump目录下,可以通过日期来判断。

SQL>show parameteruser_dump_dest

 

也可以使用如下SQL 查询对应的trace 文件:

 

SELECT a.VALUE ||b.symbol|| c.instance_name|| '_ora_' ||d.spid|| '.trc'

trace_file

FROM (SELECT VALUE

FROMv$parameter

WHERE name = 'user_dump_dest') a,

(SELECT SUBSTR (VALUE, -6, 1)symbol

FROMv$parameter

WHERE name = 'user_dump_dest') b,

(SELECTinstance_name FROMv$instance) c,

(SELECTspid

FROMv$session s,v$process p,v$mystat m

WHERE s.paddr= p.addrAND s.sid = m.sid AND m.statistic#= 0) d

 

TRACE_FILE

--------------------------------------------------------------------------------

/u01/app/oracle/admin/dave/udump/dave_ora_7215.trc

 

整个Trace 的内容如下:

[oracle@qs-dmm-rh2 udump]$ cat dave_ora_7215.trc

/u01/app/oracle/admin/dave/udump/dave_ora_7215.trc

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 -Production

With the Partitioning, OLAP, Data Mining and Real ApplicationTesting options

ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1

System name: Linux

Node name: qs-dmm-rh2

Release: 2.6.18-194.el5

Version: #1 SMP Tue Mar16 21:52:43 EDT 2010

Machine: i686

Instance name: dave

Redo thread mounted by this instance: 0

Oracle process number: 15

Unix process pid: 7215, image: oracle@qs-dmm-rh2 (TNS V1-V3)

 

*** ACTION NAME:() 2011-03-17 22:05:46.401

*** MODULE NAME:(sqlplus@qs-dmm-rh2 (TNS V1-V3)) 2011-03-1722:05:46.401

*** SERVICE NAME:() 2011-03-17 22:05:46.401

*** SESSION ID:(159.1) 2011-03-17 22:05:46.401

ORA-01160: file is not a data file

ORA-01110: data file : '/u01/app/oracle/oradata/dave/temp01.dbf'

*** 2011-03-17 22:08:25.791

Control file created with size 370 blocks

*** 2011-03-17 22:10:21.444

tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x1)

tkcrrpa: (WARN) Failed initial attempt to send ARCH message(message:0x1)

kwqmnich: current time:: 14: 10: 24

kwqmnich: instance no 0 check_only flag 1

kwqmnich: initialized job cache structure

krvscm(+): Validating controlfile with logical metadata

krvscm(+): Initial controlfile state

krvscm(+): kccdiflg [400001]kccdifl2 [1000]

krvscm(+): kccdi2ldscn[0x0000.00000000]

krvscm(+): kccdi2lrscn[0x0000.00000000]

krvscm(+): Inspecting logical metadata

krvscm(+): Metadata state

krvscm(+): hasPrepSwitchSta[0]

krvscm(+): hasPrepSwitchPri[0]

krvscm(+): hasReceivedDict[0]

krvscm(+): hasDumpedDict [0]

krvscm(+): hasCommittedBor[0]

krvscm(+): hasSwitchedFromPri [0]

krvscm(+): hasStartedTa [0]

krvscm(+): hasValidSess [0]

krvscm(+): hasTxnConsistency[0]

krvscm(+): hasCleanlyShutdown [0]

krvscm(+): Generating new controlfile state from metadata

krvscm(+): Updating controlfile with new state

krvscm(+): New controlfile state

krvscm(+): kccdiflg [400001]kccdifl2 [1000]

krvscm(+): kccdi2ldscn[0x0000.00000000]

krvscm(+): kccdi2lrscn[0x0000.00000000]

krvscm(+): Updating SGA associated with controlfile state

krvscm(+): Validation complete

*** 2011-03-17 22:13:21.115

-- The following are current System-scope REDO Log Archival related

-- parameters and can be included in the database initializationfile.

--

-- LOG_ARCHIVE_DEST=''

-- LOG_ARCHIVE_DUPLEX_DEST=''

--

-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf

--

-- DB_UNIQUE_NAME="dave_st"

--

-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE'

-- LOG_ARCHIVE_CONFIG='DG_CONFIG=("dave_pd")'

-- LOG_ARCHIVE_MAX_PROCESSES=2

-- STANDBY_FILE_MANAGEMENT=AUTO

-- STANDBY_ARCHIVE_DEST=/u01/archivelog

-- FAL_CLIENT=dave_st

-- FAL_SERVER=dave_pd

--

-- LOG_ARCHIVE_DEST_2='SERVICE=dave_pd'

-- LOG_ARCHIVE_DEST_2='OPTIONAL REOPEN=120 NODELAY'

-- LOG_ARCHIVE_DEST_2='LGWR NOAFFIRM NOEXPEDITE NOVERIFYASYNC=61440'

-- LOG_ARCHIVE_DEST_2='REGISTER NOALTERNATE NODEPENDENCY'

-- LOG_ARCHIVE_DEST_2='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED'

-- LOG_ARCHIVE_DEST_2='DB_UNIQUE_NAME=dave_pd'

-- LOG_ARCHIVE_DEST_2='VALID_FOR=(STANDBY_LOGFILE,STANDBY_ROLE)'

-- LOG_ARCHIVE_DEST_STATE_2=ENABLE

--

-- LOG_ARCHIVE_DEST_1='LOCATION=/u01/archivelog'

-- LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'

-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'

-- LOG_ARCHIVE_DEST_1='REGISTER NOALTERNATE NODEPENDENCY'

-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED'

-- LOG_ARCHIVE_DEST_1='DB_UNIQUE_NAME=dave_st'

-- 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 setopens

-- the database with the NORESETLOGS option and should be used onlyif

-- the current versions of all online logs are available. The second

-- set opens the database with the RESETLOGS option and should beused

-- if online logs are unavailable.

-- The appropriate set of statements can be copiedfrom the trace into

-- a script file, edited as necessary, andexecuted when there is a

-- need to re-create the control file.

--

-- Set#1. NORESETLOGS case

--对使用noresetlogs 的说明

--

-- 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

-- protection mode:

-- ALTER DATABASE SET STANDBYDATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "DAVE" NORESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 2

MAXDATAFILES 30

MAXINSTANCES 1

MAXLOGHISTORY 292

LOGFILE

GROUP 1'/u01/app/oracle/oradata/dave/redo01.log' SIZE 50M,

GROUP 2'/u01/app/oracle/oradata/dave/redo02.log' SIZE 50M,

GROUP 3'/u01/app/oracle/oradata/dave/redo03.log' SIZE 50M

-- STANDBY LOGFILE

DATAFILE

'/u01/app/oracle/oradata/dave/system01.dbf',

'/u01/app/oracle/oradata/dave/undotbs01.dbf',

'/u01/app/oracle/oradata/dave/sysaux01.dbf',

'/u01/app/oracle/oradata/dave/users01.dbf'

CHARACTER SET ZHS16GBK

;

--以上是创建控制文件的语法

-- 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/archivelog/1_1_746031707.dbf';

-- Recovery is required if any of the datafiles are restoredbackups,

-- or if the last shutdown was not normal orimmediate.

RECOVER DATABASE

-- All logs need archiving and a log switch isneeded.

ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.

ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.

-- Online tempfiles have complete space information.

-- Other tempfiles may require adjustment.

ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/dave/temp01.dbf'

SIZE 32505856 REUSE AUTOEXTEND OFF;

--这里是要注意的地方,重建控制文件的时候,不能写上临时表空间,等控制文件创建完毕之后,在手工的执行SQL加上临时表空间。

-- End of tempfile additions.

--

-- Set#2. RESETLOGS case

--第二种情况,使用resetlogs 的说明

--

-- The following commands will create a new control file and use it

-- to open the database.

-- Data used by Recovery Manager will be lost.

-- The contents of online logs will be lost and all backups will

-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL

-- statement will place the database in the appropriate

-- protection mode:

-- ALTER DATABASE SET STANDBYDATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "DAVE" RESETLOGS ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 2

MAXDATAFILES 30

MAXINSTANCES 1

MAXLOGHISTORY 292

LOGFILE

GROUP 1'/u01/app/oracle/oradata/dave/redo01.log' SIZE 50M,

GROUP 2'/u01/app/oracle/oradata/dave/redo02.log' SIZE 50M,

GROUP 3 '/u01/app/oracle/oradata/dave/redo03.log' SIZE 50M

-- STANDBY LOGFILE

DATAFILE

'/u01/app/oracle/oradata/dave/system01.dbf',

'/u01/app/oracle/oradata/dave/undotbs01.dbf',

'/u01/app/oracle/oradata/dave/sysaux01.dbf',

'/u01/app/oracle/oradata/dave/users01.dbf'

CHARACTER SET ZHS16GBK

;

-- 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/archivelog/1_1_746031707.dbf';

-- Recovery is required if any of the datafilesare restored backups,

-- or if the last shutdown was not normal or immediate.

RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.

ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.

-- Online tempfiles have complete space information.

-- Other tempfiles may require adjustment.

ALTER TABLESPACE TEMP ADD TEMPFILE'/u01/app/oracle/oradata/dave/temp01.dbf'

SIZE 32505856 REUSE AUTOEXTEND OFF;

-- End of tempfile additions.

--

 

注意里面的几个参数:

(1) MAXDATAFILES

The MAXDATAFILES optionof CREATE DATABASE determines the number of data files a database can have.With Oracle Real Application Clusters, databases tend to have more data filesand log files than an exclusive mounted database.

(2) MAXINSTANCES

The MAXINSTANCES optionof CREATE DATABASE limits the number of instances that can access a databaseconcurrently. The default value for this option underz/OS is 15. Set MAXINSTANCES to a value greater than the maximum numberof instances you expect to run concurrently.

(3)MAXLOGFILE and MAXLOGMEMBERS

The MAXLOGFILES optionof CREATE DATABASE specifies the maximum number of redo log groups that can becreated for the database. The MAXLOGMEMBERS option specifies the maximum numberof members or number of copies per group. Set MAXLOGFILES to the maximum numberof instances you plan to run concurrently multiplied by the maximum anticipatednumber of groups per thread.

(4)MAXLOGHISTORY

The MAXLOGHISTORY optionof CREATE DATABASE specifies the maximum number of redolog files that can be recorded in the log history of the control file.The log history is used for automatic media recovery of Oracle Real ApplicationClusters.

ForOracle Real Application Clusters, set MAXLOGHISTORY to a large value, such as100. The control file can then store information about this number ofredo log files. When the log history exceeds this limit, the Oracle serveroverwrites the oldest entries in the log history. Thedefault for MAXLOGHISTORY is 0 (zero), which disables log history.

 

这4个参数中,我们在创建DB 时需要注意的是MAXDATAFILES 和MAXLOGHISTORY。 因为默认值较小。 在创建DB 时就需要把这2个参数设置成较大值。

 

比如MAXDATAFILES 设置成8k,MAXLOGHISTORY 设置成1k。

 

与这几个参数相关的错误:

ORA-01164: MAXLOGFILES may not exceed string

Cause: MAXLOGFILES specified on the command line too large.

Action: Resubmit the command with a smaller MAXLOGFILES

 

ORA-01165:MAXDATAFILES may not exceed string

Cause: MAXDATAFILES specified on the command line too large.

Action: Resubmit the command with a smaller MAXDATAFILES

 

ORA-01166:file number string is larger than string (string)

Cause: File mentioned in CREATE CONTROLFILE has a file number whichis larger than that specified for MAXDATAFILES or MAXLOGFILES.

Action: Increase the maximum specified on the command line.


    
 
 

您可能感兴趣的文章:

  • Oracle新手教程 手工创建数据库的全部脚本及说明
  • 求详细linux(redhed9)上安装oracle9i的说明书?
  • ORACLE 中几个难以理解的概念说明
  • Oracle数据库异构服务原理及实例说明
  • ORACLE实现字段自增示例说明
  • Oracle中手工创建数据库的全部脚本与说明
  • Oracle 高速批量数据加载工具sql*loader使用说明
  • Oracle 数据库导出(exp)导入(imp)说明
  • 关于Oracle 数据库的配置方案说明
  • Oracle 启动例程 STARTUP参数说明
  • Oracle 语句优化分析说明第1/2页
  • oracle iSQL*PLUS配置设置图文说明
  • oracle常用数据类型说明
  • 在HP Unix 下Oracle的控制和管理
  • Oracle控制文件多元化处理
  • Oracle10g 控制台启动端口修改
  • Oracle中存取控制介绍
  • Oracle并购SUN应放松对MySQL控制
  • Oracle中虚拟专用数据控制方法研究
  • Linux平台下启动oracle 11g EM控制台
  • Oracle 入门之控制文件multiplex
  • 手工创建Oracle数据库控制文件的策略
  • Oracle备份的控制文件和新的数据文件
  • Oracle控制文件的损坏或完全丢失的恢复办法
  • Oracle数据操作和控制语言详解
  • DB2和 Oracle的并发控制(锁)的比较
  • Oracle中基于hint的3种执行计划控制方法详细介绍
  •  
    本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
    本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • Linux平台下Oracle 密码文件重建
  • Oracle数据库访问参数文件的顺序
  • Oracle 对数据文件大小的限制
  • Oracle移动数据文件到新分区步骤分析
  • 在jsp文件中怎么设置oracle的路径:很简单的,只是因为我不会;
  • Oracle的spfile参数文件
  • linux下通过对文件读取方式查询oracle的版本信息
  • 求高手指点shell导入.dat文件到ORACLE数据库
  • jsp文件连接oracle失败
  • linux 安装 oracle 运行./runinstall 提示没有这个文件
  • oracle删除文件后数据库启动不了的处理方法
  • 请教:为什么删除不掉?我用超级用户删除某一文件夹rm -R oracle失败。
  • Oracle数据库逻辑备份的SH文件
  • 利用多个转储文件导出大量Oracle数据
  • 50分的题:如何给oracle减肥?在linux多目录的环境下查找体积最大的单个文件??
  • 用oracle pl/sql 从A unix机器,去读取B unix机器上的一个文件,怎么实现?
  • 读取oracle数据库表写文件慢
  • 如何向oracle中写入一个大文件?谢谢!
  • jsp文件上传smartupload到oracle数据库中没有longblob的数据类型如何处理的?
  • 用Jbuilder编译文件,提示找不到oracle驱动?
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • oracle iis7站长之家
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,