Specifying CREATE DATABASE StatementClauses

When you executeaCREATEDATABASEstatement,Oracle Database performs several operations. The actual operations performeddepend on the clauses that you specify in theCREATEDATABASEstatementand the initialization parameters that you have set. Oracle Database performsat least these operations:

执行CREATE DATABASE语句时,Oracle数据库将执行多个操作。 执行的实际操作取决于您在CREATE DATABASE语句中指定的子句和您设置的初始化参数。 Oracle数据库至少执行以下操作:

Creates the datafiles for the database Creates the control files for the database Creates the redo log files for the database and establishes theARCHIVELOGmode Creates theSYSTEMtablespace Creates theSYSAUXtablespace Creates the data dictionary Sets the character set that stores data in the database Sets the database time zone Mounts and opens the database for use

This sectiondiscusses several of the clauses of theCREATEDATABASEstatement. It expands upon some ofthe clauses discussed in"Step 9: Issue the CREATE DATABASEStatement"and introduces additional ones. Many of theCREATE DATABASEclauses discussed here can be usedto simplify the creation and management of your database.

The followingtopics are contained in this section:

Protecting Your Database: Specifying Passwords for Users SYS and SYSTEM Creating a Locally Managed SYSTEM Tablespace About the SYSAUX Tablespace Using Automatic Undo Management: Creating an Undo Tablespace Creating a Default Temporary Tablespace Specifying Oracle Managed Files at Database Creation Supporting Bigfile Tablespaces During Database Creation Specifying the Database Time Zone and Time Zone File Specifying FORCE LOGGING Mode

Protecting YourDatabase: Specifying Passwords for Users SYS and SYSTEM

The clauses oftheCREATEDATABASEstatement used for specifying thepasswords for usersSYSandSYSTEMare:

USERSYSIDENTIFIEDBYpassword USERSYSTEMIDENTIFIEDBYpassword

If you omitthese clauses, then these users are assigned the default passwordschange_on_installandmanager, respectively. A record is written tothe alert log indicating that the default passwords were used. To protect yourdatabase, you must change these passwords using theALTER USERstatement immediately afterdatabase creation.

如果省略这些子句,则分别为这些用户分配默认密码change_on_install和manager。 将一条记录写入警报日志,指示使用了默认密码。 为了保护数据库,您必须在数据库创建后立即使用ALTER USER语句更改这些密码。

Oracle stronglyrecommends that you specify these clauses, even though they are optional inthis release of Oracle Database. The default passwords are commonly known, andif you neglect to change them later, then you leave database vulnerable toattack by malicious users.

Oracle强烈推荐指定这些子句,即使在此版本的Oracle数据库中它们是可选的。 默认密码是众所周知的,如果稍后忽略更改密码,则会使数据库容易受到恶意用户的攻击。

When choosing apassword, keep in mind that beginning in Release 11g, passwords arecase-sensitive. Also, there may be password formatting requirements for yourdatabase. See the section entitled "How Oracle Database Checks theComplexity of Passwords" inOracle Database Security Guidefor moreinformation.

选择密码时,请记住,从11g版开始,密码区分大小写。此外,你的数据库可能存在密码格式化要求。

See Also:

"Some Security Considerations"

Creating aLocally ManagedSYSTEM Tablespace

SpecifytheEXTENT MANAGEMENT LOCALclause in theCREATEDATABASEstatement to create a locallymanagedSYSTEMtablespace.TheCOMPATIBLEinitializationparameter must be set to 10.0.0 or higher for this statement to be successful.If you do not specify theEXTENT MANAGEMENT LOCALclause, then by default the database creates adictionary-managedSYSTEMtablespace.Dictionary-managed tablespaces are deprecated.

在CREATE DATABASE语句中指定EXTENT MANAGEMENTLOCAL子句,以创建本地管理的SYSTEM表空间。 COMPATIBLE初始化参数必须设置为10.0.0或更高才能使此语句成功。 如果不指定EXTENT MANAGEMENT LOCAL子句,则默认情况下,数据库将创建一个字典管理的SYSTEM表空间。 字典管理的表空间已被弃用。

If you createyour database with a locally managedSYSTEMtablespace, and if you are notusing Oracle Managed Files, then ensure that the following conditions are met:

如果使用本地管理的SYSTEM表空间创建数据库,并且如果不使用Oracle Managed Files,那么请确保满足以下条件:

You specify theDEFAULTTEMPORARYTABLESPACEclause in theCREATEDATABASEstatement. You include theUNDO TABLESPACEclause in theCREATEDATABASEstatement.

See Also:

· Oracle Database SQL Language Referencefor morespecific information about the use of theDEFAULT TEMPORARY TABLESPACEandUNDO TABLESPACEclauses whenEXTENT MANAGEMENT LOCALisspecified for theSYSTEMtablespace

· "Locally Managed Tablespaces"

· "Migrating the SYSTEM Tablespace toa Locally Managed Tablespace"

About the SYSAUXTablespace

TheSYSAUXtablespace is always created atdatabase creation. TheSYSAUXtablespaceserves as an auxiliary tablespace to theSYSTEMtablespace. Because it is thedefault tablespace for many Oracle Database features and products thatpreviously required their own tablespaces, it reduces the number of tablespacesrequired by the database. It also reduces the load on theSYSTEMtablespace.

SYSAUX表空间始终在创建数据库时创建。 SYSAUX表空间用作SYSTEM表空间的辅助表空间。 因为它是以前需要自己的表空间的许多Oracle数据库功能和产品的默认表空间,因此可以减少数据库所需的表空间数量。 它还减少了SYSTEM表空间的负载。

You can specifyonly datafile attributes for theSYSAUXtablespace, using theSYSAUX DATAFILEclause in theCREATEDATABASEstatement. Mandatory attributes oftheSYSAUXtablespaceare set by Oracle Database and include:

你可以使用CREATE DATABASE语句中的SYSAUX DATAFILE子句来指定SYSAUX表空间的数据文件属性。 SYSAUX表空间的必需属性由Oracle数据库设置,包括:

PERMANENT READWRITE EXTENTMANAGMENTLOCAL SEGMENTSPACEMANAGMENTAUTO

You cannot alterthese attributes with anALTERTABLESPACEstatement, and any attempt to doso will result in an error. You cannot drop or rename theSYSAUXtablespace.

不能使用ALTER TABLESPACE语句更改这些属性,任何尝试都会导致错误。您不能删除或重命名SYSAUX表空间。

The size oftheSYSAUXtablespaceis determined by the size of the database components that occupySYSAUX. You can view a list of thesecomponents by querying theV$SYSAUX_OCCUPANTSview. Based on the initial sizes of thesecomponents, theSYSAUXtablespacemust be at least 400 MB at the time of database creation. The spacerequirements of theSYSAUXtablespacewill increase after the database is fully deployed, depending on the nature ofits use and workload. For more information on how to manage the spaceconsumption of theSYSAUXtablespaceon an ongoing basis, see the"Managing the SYSAUX Tablespace".

SYSAUX表空间的大小由占用SYSAUX的数据库组件的大小决定。你可以通过查询V$SYSAUX_OCCUPANTS视图来查看这些组件的列表。根据这些组件的初始大小,在创建数据库时,SYSAUX表空间必须至少为400 MB。数据库完全部署后,SYSAUX表空间的空间要求将会增加,这取决于其使用和工作负载的性质。

If you includeaDATAFILEclause fortheSYSTEMtablespace,then you must specify theSYSAUX DATAFILEclause as well, or theCREATEDATABASEstatement will fail. Thisrequirement does not exist if the Oracle Managed Files feature is enabled(see"Specifying Oracle Managed Files atDatabase Creation").

如果为SYSTEM表空间包含DATAFILE子句,则必须指定SYSAUX DATAFILE子句,否则CREATE DATABASE语句将失败。如果启用Oracle Managed Files功能,则此要求不存在

TheSYSAUXtablespace has the same securityattributes as theSYSTEMtablespace.

SYSAUX表空间具有与SYSTEM表空间相同的安全属性。

Note:

This documentation discusses thecreation of theSYSAUXdatabaseat database creation. When upgrading from a release of Oracle Database that didnot require theSYSAUXtablespace,you must create theSYSAUXtablespaceas part of the upgrade process. This is discussed inOracle Database Upgrade Guide.

See Also:"Managing the SYSAUXTablespace"

在创建数据库时创建SYSAUX数据库。的、在Oracle数据库版本进行升级时,从不需要SYSAUX表空间,必须在升级过程中创建SYSAUX表空间。

Using AutomaticUndo Management: Creating an Undo Tablespace

Automatic undomanagement uses an undo tablespace. To enable automatic undo management, settheUNDO_MANAGEMENTinitializationparameter toAUTOin yourinitialization parameter file. Or, omit this parameter, and the databasedefaults to automatic undo management. In this mode, undo data is stored in anundo tablespace and is managed by Oracle Database. To define and name the undotablespace yourself, you must include theUNDO TABLESPACEclause in theCREATE DATABASEstatement at database creationtime. If you omit this clause, and automatic undo management is enabled, thenthe database creates a default undo tablespace namedSYS_UNDOTBS.

自动undo管理使用undo表空间。 要启用自动undo管理,请在初始化参数文件中将UNDO_MANAGEMENT初始化参数设置为AUTO。 或者,省略此参数,11g数据库默认为自动undo管理。 在此模式下,undo数据存储在undo表空间中,由Oracle数据库管理。 要自己定义和命名undo表空间,必须在数据库创建时将CROTE DATABASE语句中包含UNDO TABLESPACE子句。 如果省略此子句,并启用自动undo管理,则数据库将创建一个名为SYS_UNDOTBS的缺省的undo表空间。

See Also:

· "Specifying the Method of UndoSpace Management"

· Chapter 16, "Managing Undo", forinformation about the creation and use of undo tablespaces

Creating aDefault Permanent Tablespace

TheDEFAULTTABLESPACEclause of theCREATEDATABASEstatement specifies a defaultpermanent tablespace for the database. Oracle Database assigns to thistablespace any non-SYSTEMusers forwhom you do not explicitly specify a different permanent tablespace. If you donot specify this clause, then theSYSTEMtablespace is the default permanenttablespace for non-SYSTEMusers.Oracle strongly recommends that you create a default permanent tablespace.

CREATE DATABASE语句中的DEFAULT TABLESPACE子句指定数据库的默认永久表空间。 Oracle数据库为此表空间分配任何未明确指定不同永久表空间的非SYSTEM用户。 如果不指定此子句,则SYSTEM表空间是非SYSTEM用户的默认永久表空间。 Oracle强烈建议创建一个默认的永久表空间。

See Also:

Oracle Database SQL Language Referencefor thesyntax of theDEFAULTTABLESPACEclauseofCREATE DATABASEandALTER DATABASE

Creating aDefault Temporary Tablespace

TheDEFAULT TEMPORARY TABLESPACEclause of theCREATEDATABASEstatement creates a defaulttemporary tablespace for the database. Oracle Database assigns this tablespaceas the temporary tablespace for users who are not explicitly assigned atemporary tablespace.

CREATE DATABASE语句的DEFAULT TEMPORARYTABLESPACE子句创建数据库的默认临时表空间。 Oracle数据库将这个表空间分配给没有显式分配临时表空间的用户。

You canexplicitly assign a temporary tablespace or tablespace group to a user intheCREATE USERstatement.However, if you do not do so, and if no default temporary tablespace has beenspecified for the database, then by default these users are assigned theSYSTEMtablespace as their temporarytablespace. It is not good practice to store temporary data in theSYSTEMtablespace, and it is cumbersometo assign every user a temporary tablespace individually. Therefore, Oraclerecommends that you use theDEFAULT TEMPORARY TABLESPACEclause ofCREATEDATABASE.

你可以在CREATE USER语句中为用户显式分配临时表空间或表空间组。 但是,如果不这样做,并且如果没有为数据库指定默认临时表空间,那么默认情况下,这些用户将被分配为SYSTEM表空间作为它们的临时表空间。 在SYSTEM表空间中存储临时数据是不好的做法,分配每个用户一个临时表空间是麻烦的。 因此,Oracle建议使用CREATE DATABASE的DEFAULT TEMPORARYTABLESPACE子句。

Note:

When you specify a locally managedSYSTEMtablespace,theSYSTEMtablespacecannotbeused as a temporary tablespace. In this case you must create a defaulttemporary tablespace. This behavior is explained in"Creating a Locally Managed SYSTEM Tablespace".

当指定本地管理的SYSTEM表空间时,SYSTEM表空间不能用作临时表空间。 在这种情况下,您必须创建一个默认的临时表空间。

SpecifyingOracle Managed Files at Database Creation

You can minimizethe number of clauses and parameters that you specify in yourCREATEDATABASEstatement by using theOracle Managed Files feature. You do this by specifyingeither a directory or Oracle Automatic Storage Management (Oracle ASM) diskgroup in which your files are created and managed by Oracle Database.

你可以通过使用Oracle托管文件功能来最小化你在CREATE DATABASE语句中指定的子句和参数数。可以通过指定由Oracle数据库创建和管理文件的目录或Oracle自动存储管理(Oracle ASM)磁盘组来执行该操作。

By including anyof the initialization parametersDB_CREATE_FILE_DEST,DB_CREATE_ONLINE_LOG_DEST_n, orDB_RECOVERY_FILE_DESTin yourinitialization parameter file, you instruct Oracle Database to create andmanage the underlying operating system files of your database. Oracle Databasewill automatically create and manage the operating system files for thefollowing database structures, depending on which initialization parameters youspecify and how you specify clauses in yourCREATEDATABASEstatement:

通过在初始化参数文件中设置初始化参数DB_CREATE_FILE_DEST,DB_CREATE_ONLINE_LOG_DEST_n或DB_RECOVERY_FILE_DEST,可以指导Oracle数据库创建和管理数据库的底层操作系统文件。 Oracle数据库将自动创建和管理以下数据库结构的操作系统文件,具体取决于你指定的初始化参数以及在CREATE DATABASE语句中指定子句:

Tablespaces and their datafiles Temporary tablespaces and their tempfiles Control files Redo log files Archived redo log files Flashback logs Block change tracking files RMAN backups

See Also:

"Specifying a Fast RecoveryArea"for information about setting initializationparameters that create a Fast Recovery Area

ThefollowingCREATEDATABASEstatement shows briefly how theOracle Managed Files feature works, assuming you have specified requiredinitialization parameters:

下面CREATE DATABASE语句简要说明了Oracle托管文件功能的工作原理,假设您已经指定了所需的初始化参数:

CREATE DATABASEmynewdb

USER SYS IDENTIFIED BY sys_password

USER SYSTEM IDENTIFIED BY system_password

EXTENT MANAGEMENT LOCAL

UNDO TABLESPACE undotbs

DEFAULT TEMPORARY TABLESPACE tempts1

DEFAULT TABLESPACE users;

TheSYSTEMtablespace is created as a locally managed tablespace. Without theEXTENTMANAGEMENTLOCALclause, theSYSTEMtablespace is created as dictionary managed, which is not recommended. NoDATAFILEclause is specified, so the database creates an Oracle managed datafile for theSYSTEMtablespace. NoLOGFILEclauses are included, so the database creates two Oracle managed redo log file groups. NoSYSAUX DATAFILEis included, so the database creates an Oracle managed datafile for theSYSAUXtablespace. NoDATAFILEsubclause is specified for theUNDO TABLESPACEandDEFAULTTABLESPACEclauses, so the database creates an Oracle managed datafile for each of these tablespaces. NoTEMPFILEsubclause is specified for theDEFAULT TEMPORARY TABLESPACEclause, so the database creates an Oracle managed tempfile. If noCONTROL_FILESinitialization parameter is specified in the initialization parameter file, then the database also creates an Oracle managed control file. If you are using a server parameter file (see"Managing Initialization Parameters Using a Server Parameter File"), then the database automatically sets the appropriate initialization parameters. SYSTEM表空间创建为本地管理的表空间。没有EXTENT MANAGEMENT LOCAL子句,SYSTEM表空间创建为字典管理,不推荐。 没有指定DATAFILE子句,因此数据库为SYSTEM表空间创建一个Oracle托管数据文件。 不包括LOGFILE子句,因此数据库创建两个Oracle管理的重做日志文件组。 不包括SYSAUX DATAFILE,因此数据库为SYSAUX表空间创建一个Oracle托管数据文件。 没有为UNDO TABLESPACE和DEFAULT TABLESPACE子句指定DATAFILE子句,因此数据库为每个这些表空间创建一个Oracle托管数据文件。 没有为DEFAULT TEMPORARY TABLESPACE子句指定TEMPFILE子句,因此数据库创建一个Oracle托管的临时文件。 如果在初始化参数文件中未指定CONTROL_FILES初始化参数,则数据库还将创建一个Oracle托管控制文件。

SupportingBigfile Tablespaces During Database Creation

Oracle Databasesimplifies management of tablespaces and enables support for ultra-largedatabases by letting you createbigfile tablespaces. Bigfiletablespaces can contain only one file, but that file can have up to 4G blocks.The maximum number of datafiles in an Oracle Database is limited (usually to64K files). Therefore, bigfile tablespaces can significantly enhance thestorage capacity of an Oracle Database.

Oracle数据库简化了表空间的管理,并通过创建bigfile表空间来支持超大型数据库。 Bigfile表空间只能包含一个数据文件,但该文件最多可以拥有4G的块。 Oracle数据库中的最大数据文件数量有限(通常为64K文件)。 因此,bigfile表空间可以显着增强Oracle数据库的存储容量。

This sectiondiscusses the clauses of theCREATEDATABASEstatementthat let you include support for bigfile tablespaces.

See Also:

"Bigfile Tablespaces"for moreinformation about bigfile tablespaces

Specifying the Default Tablespace Type

TheSET DEFAULT...TABLESPACEclause oftheCREATEDATABASEstatement determines the defaulttype of tablespace for this database in subsequentCREATETABLESPACEstatements. Specify eitherSET DEFAULT BIGFILE TABLESPACEorSET DEFAULT SMALLFILE TABLESPACE. If you omitthis clause, then the default is asmallfile tablespace, which is thetraditional type of Oracle Database tablespace. A smallfile tablespace cancontain up to 1022 files with up to 4M blocks each.

CREATE DATABASE语句的SET DEFAULT ...TABLESPACE子句决定CREATE TABLESPACE语句中表空间的默认类型。 指定SET DEFAULT BIGFILETABLESPACE或SET DEFAULT SMALLFILE TABLESPACE。 如果省略此子句,那么默认是一个smallfile表空间,它是传统类型的Oracle数据库表空间。 一个smallfile表空间最多可以包含1022个文件,最多可以有4M块。

The use ofbigfile tablespaces further enhances the Oracle Managed Files feature, becausebigfile tablespaces make datafiles completely transparent for users. SQL syntaxfor theALTERTABLESPACEstatement has been extended toallow you to perform operations on tablespaces, rather than the underlyingdatafiles.

使用bigfile表空间进一步增强了Oracle Managed Files功能,因为bigfile表空间使数据文件对用户完全透明。 已经扩展了ALTER TABLESPACE语句的SQL语法,允许对表空间执行操作,而不是数据文件。

TheCREATEDATABASEstatement shown in"Specifying Oracle Managed Files atDatabase Creation"can be modified as follows to specify that thedefault type of tablespace is a bigfile tablespace:

“数据库创建时指定Oracle托管文件”中CREATE DATABASE语句可以修改如下,以指定默认类型的表空间是一个bigfile表空间:

CREATE DATABASEmynewdb

USER SYS IDENTIFIED BY sys_password

USER SYSTEM IDENTIFIED BY system_password

SET DEFAULT BIGFILE TABLESPACE

UNDO TABLESPACE undotbs

DEFAULT TEMPORARY TABLESPACE tempts1;

To dynamicallychange the default tablespace type after database creation, use theSET DEFAULT TABLESPACEclause oftheALTER DATABASEstatement:

ALTER DATABASESET DEFAULT BIGFILE TABLESPACE;

要在创建数据库后动态更改默认表空间类型,请使用ALTER DATABASE语句的SET DEFAULTTABLESPACE子句:

You candetermine the current default tablespace type for the database by queryingtheDATABASE_PROPERTIESdatadictionary view as follows:

你可以通过查询DATABASE_PROPERTIES数据字典视图来确定数据库的当前缺省表空间类型,如下所示:

SELECTPROPERTY_VALUE FROM DATABASE_PROPERTIES

WHERE PROPERTY_NAME = 'DEFAULT_TBS_TYPE';


Overriding theDefault Tablespace Type

TheSYSTEMandSYSAUXtablespaces are always createdwith the default tablespace type. However, you can explicitly override thedefault tablespace type for theUNDOandDEFAULTTEMPORARYtablespace during theCREATEDATABASEoperation.

SYSTEM和SYSAUX表空间始终使用默认表空间类型创建。 但是,你可以在CREATE DATABASE时显式覆盖UNDO和DEFAULTTEMPORARY表空间的默认表空间类型。

For example, you can create abigfileUNDOtablespacein a database with the default tablespace type of smallfile as follows:

例如,你可以在数据库中创建一个bigfile UNDO表空间,其默认表空间类型为smallfile,如下所示:

CREATE DATABASEmynewdb

...

BIGFILE UNDO TABLESPACE undotbs

DATAFILE'/u01/oracle/oradata/mynewdb/undotbs01.dbf'

SIZE 200M REUSE AUTOEXTEND ON MAXSIZEUNLIMITED;

You can create a smallfileDEFAULTTEMPORARYtablespace in a database with thedefault tablespace type of bigfile as follows:

CREATE DATABASEmynewdb

SET DEFAULT BIGFILE TABLESPACE

...

SMALLFILE DEFAULT TEMPORARY TABLESPACEtempts1

TEMPFILE'/u01/oracle/oradata/mynewdb/temp01.dbf'

SIZE 20M REUSE

...


Specifying theDatabase Time Zone and Time Zone File

This sectioncontains:

Setting the Database Time Zone About the Database Time Zone Files Specifying the Database Time Zone File

Setting theDatabase Time Zone

Set the databasetime zone when the database is created by using theSET TIME_ZONEclause of theCREATE DATABASEstatement. If you do not set thedatabase time zone, then it defaults to the time zone of the host operatingsystem.

使用CREATE DATABASE语句的SET TIME_ZONE子句创建数据库时设置数据库时区。 如果不设置数据库时区,则默认为主机操作系统的时区。

You can changethe database time zone for a session by using theSET TIME_ZONEclause of theALTER SESSIONstatement.

你可以使用ALTER SESSION语句的SET TIME_ZONE子句更改会话的数据库时区。

See Also:

Oracle Database Globalization SupportGuidefor more information about setting the database time zone


About theDatabase Time Zone Files

Two time zonefiles are included in a subdirectory of the Oracle home directory. Thetime zone files contain the valid time zone names. Thefollowing information is also included for each time zone:

两个时区文件包含在Oracle主目录的子目录中。 时区文件包含有效的时区名称。 每个时区也包括以下信息:

Offset from Coordinated Universal Time (UTC) Transition times for Daylight Saving Time Abbreviations for standard time and Daylight Saving Time

The default timezone file isORACLE_HOME/oracore/zoneinfo/timezlrg_11.dat. Asmaller time zone file with fewer time zones can be found inORACLE_HOME/oracore/zoneinfo/timezone_11.dat.

默认时区文件为$ORACLE_HOME / oracore / zoneinfo / timezlrg_11.dat。 $ORACLE_HOME/ oracore / zoneinfo / timezone_11.dat中可以找到较小时区文件。

要查看数据库使用的文件中的时区名称,请使用以下查询

To view the timezone names in the file being used by your database, use the following query:

SELECT * FROMV$TIMEZONE_NAMES;

See Also:

Oracle Database Globalization SupportGuidefor more information about managing and selecting time zone files

Specifying theDatabase Time Zone File

All databases that share informationmust use the same time zone datafile.

共享信息的所有数据库必须使用相同的时区数据文件。

The databaseserver always uses the large time zone file by default. If you would like touse the small time zone file on the client and know that all your data willrefer only to regions in the small file, you can set theORA_TZFILEenvironment variable on the clientto the full path name of the timezone_version.dat file on the client, whereversionmatches the time zone file versionthat is being used by the database server.

数据库服务器默认使用大时区文件。 如果在客户端上要使用小时区文件,并且知道所有数据只能引用小文件中的区域,则可以将客户端上的ORA_TZFILE环境变量设置为timezone_version.dat的完整路径名,其中版本要与数据库服务器正在使用的时区文件版本相匹配。

If you arealready using the default larger time zone file on the client, then it is notpractical to change to the smaller time zone file, because the database maycontain data with time zones that are not part of the smaller file.

如果你已经在客户端上使用默认较大的时区文件,那么更改为较小的时区文件是不切实际的,因为数据库可能包含不属于较小文件的时区的数据。


Specifying FORCELOGGING Mode

Some datadefinition language statements (such asCREATETABLE) allow theNOLOGGINGclause, which causes some databaseoperations not to generate redo records in the database redo log. TheNOLOGGINGsetting can speed up operationsthat can be easily recovered outside of the database recovery mechanisms, butit can negatively affect media recovery and standby databases.

一些数据定义语言语句(例如CREATE TABLE)允许NOLOGGING子句,这导致一些数据库操作不会在数据库redo日志中生成重做记录。 NOLOGGING设置可以加快在数据库恢复机制之外轻松恢复的操作,但会对介质恢复和备用数据库产生负面影响。

Oracle Databaselets you force the writing of redo records even whenNOLOGGINGhas been specified in DDLstatements. The database never generates redo records for temporary tablespacesand temporary segments, so forced logging has no affect for objects.

即使在DDL语句中指定了NOLOGGING,Oracle数据库也可以强制写入redo记录。 数据库从不为临时表空间和临时段生成重做记录,因此强制日志对对象没有影响。

See Also:

Oracle Database SQL Language Referenceforinformation about operations that can be done inNOLOGGINGmode

Using the FORCELOGGING Clause

To put thedatabase intoFORCELOGGINGmode, usetheFORCE LOGGINGclause intheCREATE DATABASEstatement.If you do not specify this clause, the database is not placed intoFORCE LOGGINGmode.

要将数据库置于FORCE LOGGING模式,请在CREATE DATABASE语句中使用FORCE LOGGING子句。 如果不指定此子句,数据库不会被置于FORCE LOGGING模式。

Use theALTER DATABASEstatement to place the databaseintoFORCE LOGGINGmode afterdatabase creation. This statement can take a considerable time for completion,because it waits for all unlogged direct writes to complete.

数据库创建后,使用ALTER DATABASE语句将数据库置于FORCE LOGGING模式。 此语句可能需要相当长的时间来完成,因为它等待所有未写入的写入才能完成。

You cancancelFORCE LOGGINGmode usingthe following SQL statement:

您可以使用以下SQL语句取消FORCE LOGGING模式:

ALTER DATABASENO FORCE LOGGING;

Independent ofspecifyingFORCELOGGINGfor thedatabase, you can selectively specifyFORCE LOGGINGorNO FORCE LOGGINGat the tablespace level. However,ifFORCE LOGGINGmode is ineffect for the database, it takes precedence over the tablespace setting. If itis not in effect for the database, then the individual tablespace settings areenforced. Oracle recommends that either the entire database is placedintoFORCE LOGGINGmode, orindividual tablespaces be placed intoFORCE LOGGINGmode, but not both.

独立于数据库来指定FORCE LOGGING,你可以在表空间级别选择性地指定FORCE LOGGING或NO FORCE LOGGING。 但是,如果FORCE LOGGING模式对数据库有效,则优先于表空间设置。 如果数据库不起作用,则会强制执行各个表空间设置。 Oracle推荐将整个数据库放入FORCE LOGGING模式,否则将各个表空间置于FORCE LOGGING模式中,但不能同时置入。

TheFORCE LOGGINGmode is a persistent attribute ofthe database. That is, if the database is shut down and restarted, it remainsin the same logging mode. However, if you re-create the control file, thedatabase is not restarted in theFORCE LOGGINGmode unless you specify theFORCE LOGGINGclause intheCREATE CONTROLFILEstatement.

FORCE LOGGING模式是数据库的持久属性。 也就是说,如果数据库被关闭并重新启动,它将保持在相同的日志记录模式。 但是,如果重新创建控制文件,除非在CREATE CONTROL FILE语句中指定了FORCE LOGGING子句,否则数据库不会在FORCE LOGGING模式下重新启动。

See Also:

"Controlling the Writing of RedoRecords"for information about using theFORCE LOGGINGclause for tablespace creation.


PerformanceConsiderations ofFORCE LOGGING Mode

FORCE LOGGINGmoderesults in some performance degradation. If the primary reason forspecifyingFORCELOGGINGis toensure complete media recovery, and there is no standby database active, thenconsider the following:

FORCE LOGGING模式导致性能下降。 如果指定FORCE LOGGING的主要原因是确保完整的介质恢复,并且没有备用数据库处于活动状态,那么请考虑以下几点:

How many media failures are likely to happen? How serious is the damage if unlogged direct writes cannot be recovered? Is the performance degradation caused by forced logging tolerable?

· 多少媒体故障可能会发生?

· 直接写入无法恢复时,损坏程度如何?

· 强制记录是否容忍性能下降?

If the databaseis running inNOARCHIVELOGmode, thengenerally there is no benefit to placing the database inFORCE LOGGINGmode. Media recovery is notpossible inNOARCHIVELOGmode, soif you combine it withFORCE LOGGING, the result may be performance degradation with little benefit.

如果数据库以NOARCHIVELOG模式运行,那么一般来说,将数据库置于FORCE LOGGING模式下通常没有任何好处。 在NOARCHIVELOG模式下,介质恢复是不可能的,因此如果将其与强制登录结合使用,结果可能会降低性能,而且效果不大。



作者:SEian.G(苦练七十二变,笑对八十一难)