温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

【翻译】Specifying CREATE DATABASE Statement Clauses

发布时间:2020-08-14 08:03:51 来源:ITPUB博客 阅读:254 作者:迷倪小魏 栏目:关系型数据库


Specifying CREATE DATABASE Statement Clauses

When you execute a CREATE DATABASE statement, Oracle Database performs several operations. The actual operations performed depend on the clauses that you specify in the CREATE DATABASE statement and the initialization parameters that you have set. Oracle Database performs at 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 the ARCHIVELOG mode
  • Creates the SYSTEM tablespace
  • Creates the SYSAUX tablespace
  • 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 section discusses several of the clauses of the CREATE DATABASE statement. It expands upon some of the clauses discussed in "Step 9: Issue the CREATE DATABASE Statement" and introduces additional ones. Many of the CREATE DATABASE clauses discussed here can be used to simplify the creation and management of your database.

The following topics 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 Your Database: Specifying Passwords for Users SYS and SYSTEM

The clauses of the CREATE DATABASE statement used for specifying the passwords for users SYS and SYSTEM are:

  • USER SYS IDENTIFIED BY password
  • USER SYSTEM IDENTIFIED BY password

If you omit these clauses, then these users are assigned the default passwords change_on_install and manager, respectively. A record is written to the alert log indicating that the default passwords were used. To protect your database, you must change these passwords using the ALTER USER statement immediately after database creation.

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

Oracle strongly recommends that you specify these clauses, even though they are optional in this release of Oracle Database. The default passwords are commonly known, and if you neglect to change them later, then you leave database vulnerable to attack by malicious users.

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

When choosing a password, keep in mind that beginning in Release 11g, passwords are case-sensitive. Also, there may be password formatting requirements for your database. See the section entitled "How Oracle Database Checks the Complexity of Passwords" in Oracle Database Security Guide for more information.

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

See Also:

"Some Security Considerations"

Creating a Locally Managed SYSTEM Tablespace

Specify thEXTENT MANAGEMENT LOCAL clause in the CREATE DATABASE statement to create a locally managed SYSTEM tablespace. The COMPATIBLE initialization parameter must be set to 10.0.0 or higher for this statement to be successful. If you do not specify the EXTENT MANAGEMENT LOCAL clause, then by default the database creates a dictionary-managed SYSTEM tablespace. Dictionary-managed tablespaces are deprecated.

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

If you create your database with a locally managed SYSTEM tablespace, and if you are not using Oracle Managed Files, then ensure that the following conditions are met:

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

  • You specify the DEFAULT TEMPORARY TABLESPACE clause in the CREATE DATABASE statement.
  • You include the UNDO TABLESPACE clause in the CREATE DATABASE statement.

See Also:

·         Oracle Database SQL Language Reference for more specific information about the use of the DEFAULT TEMPORARY TABLESPACE and UNDO TABLESPACE clauses when EXTENT MANAGEMENT LOCAL is specified for the SYSTEM tablespace

·         "Locally Managed Tablespaces"

·         "Migrating the SYSTEM Tablespace to a Locally Managed Tablespace"

About the SYSAUX Tablespace

The SYSAUX tablespace is always created at database creation. The SYSAUX tablespace serves as an auxiliary tablespace to the SYSTEM tablespace. Because it is the default tablespace for many Oracle Database features and products that previously required their own tablespaces, it reduces the number of tablespaces required by the database. It also reduces the load on the SYSTEM tablespace.

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

You can specify only datafile attributes for the SYSAUX tablespace, using the SYSAUX DATAFILE clause in the CREATE DATABASE statement. Mandatory attributes of the SYSAUX tablespace are set by Oracle Database and include:

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

  • PERMANENT
  • READ WRITE
  • EXTENT MANAGMENT LOCAL
  • SEGMENT SPACE MANAGMENT AUTO

You cannot alter these attributes with an ALTER TABLESPACE statement, and any attempt to do so will result in an error. You cannot drop or rename the SYSAUXtablespace.

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

The size of the SYSAUX tablespace is determined by the size of the database components that occupy SYSAUX. You can view a list of these components by querying the V$SYSAUX_OCCUPANTS view. Based on the initial sizes of these components, the SYSAUX tablespace must be at least 400 MB at the time of database creation. The space requirements of the SYSAUX tablespace will increase after the database is fully deployed, depending on the nature of its use and workload. For more information on how to manage the space consumption of the SYSAUX tablespace on an ongoing basis, see the "Managing the SYSAUX Tablespace".

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

If you include a DATAFILE clause for the SYSTEM tablespace, then you must specify the SYSAUX DATAFILE clause as well, or the CREATE DATABASE statement will fail. This requirement does not exist if the Oracle Managed Files feature is enabled (see "Specifying Oracle Managed Files at Database Creation").

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

The SYSAUX tablespace has the same security attributes as the SYSTEM tablespace.

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

Note:

This documentation discusses the creation of the SYSAUX database at database creation. When upgrading from a release of Oracle Database that did not require the SYSAUX tablespace, you must create the SYSAUX tablespace as part of the upgrade process. This is discussed in Oracle Database Upgrade Guide.

See Also:"Managing the SYSAUX Tablespace"

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

Using Automatic Undo Management: Creating an Undo Tablespace

Automatic undo management uses an undo tablespace. To enable automatic undo management, set the UNDO_MANAGEMENT initialization parameter to AUTO in your initialization parameter file. Or, omit this parameter, and the database defaults to automatic undo management. In this mode, undo data is stored in an undo tablespace and is managed by Oracle Database. To define and name the undo tablespace yourself, you must include the UNDO TABLESPACE clause in theCREATE DATABASE statement at database creation time. If you omit this clause, and automatic undo management is enabled, then the database creates a default undo tablespace named SYS_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 Undo Space Management"

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

Creating a Default Permanent Tablespace

The DEFAULT TABLESPACE clause of the CREATE DATABASE statement specifies a default permanent tablespace for the database. Oracle Database assigns to this tablespace any non-SYSTEM users for whom you do not explicitly specify a different permanent tablespace. If you do not specify this clause, then the SYSTEMtablespace is the default permanent tablespace for non-SYSTEM users. 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 Reference for the syntax of the DEFAULT TABLESPACE clause of CREATE DATABASE and ALTER DATABASE

Creating a Default Temporary Tablespace

The DEFAULT TEMPORARY TABLESPACE clause of the CREATE DATABASE statement creates a default temporary tablespace for the database. Oracle Database assigns this tablespace as the temporary tablespace for users who are not explicitly assigned a temporary tablespace.

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

You can explicitly assign a temporary tablespace or tablespace group to a user in the CREATE USER statement. However, if you do not do so, and if no default temporary tablespace has been specified for the database, then by default these users are assigned the SYSTEM tablespace as their temporary tablespace. It is not good practice to store temporary data in the SYSTEM tablespace, and it is cumbersome to assign every user a temporary tablespace individually. Therefore, Oracle recommends that you use the DEFAULT TEMPORARY TABLESPACE clause of CREATE DATABASE.

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

Note:

When you specify a locally managed SYSTEM tablespace, the SYSTEM tablespace cannot be used as a temporary tablespace. In this case you must create a default temporary tablespace. This behavior is explained in "Creating a Locally Managed SYSTEM Tablespace".

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

 

Specifying Oracle Managed Files at Database Creation

You can minimize the number of clauses and parameters that you specify in your CREATE DATABASE statement by using the Oracle Managed Files feature. You do this by specifying either a directory or Oracle Automatic Storage Management (Oracle ASM) disk group in which your files are created and managed by Oracle Database.

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

 

By including any of the initialization parameters DB_CREATE_FILE_DEST, DB_CREATE_ONLINE_LOG_DEST_n, or DB_RECOVERY_FILE_DEST in your initialization parameter file, you instruct Oracle Database to create and manage the underlying operating system files of your database. Oracle Database will automatically create and manage the operating system files for the following database structures, depending on which initialization parameters you specify and how you specify clauses in your CREATE DATABASE statement:

通过在初始化参数文件中设置初始化参数DB_CREATE_FILE_DESTDB_CREATE_ONLINE_LOG_DEST_nDB_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 Recovery Area" for information about setting initialization parameters that create a Fast Recovery Area

The following CREATE DATABASE statement shows briefly how the Oracle Managed Files feature works, assuming you have specified required initialization parameters:

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

CREATE DATABASE mynewdb

     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;

  • The SYSTEM tablespace is created as a locally managed tablespace. Without the EXTENT MANAGEMENT LOCAL clause, the SYSTEM tablespace is created as dictionary managed, which is not recommended.
  • No DATAFILE clause is specified, so the database creates an Oracle managed datafile for the SYSTEM tablespace.
  • No LOGFILE clauses are included, so the database creates two Oracle managed redo log file groups.
  • No SYSAUX DATAFILE is included, so the database creates an Oracle managed datafile for the SYSAUX tablespace.
  • No DATAFILE subclause is specified for the UNDO TABLESPACE and DEFAULT TABLESPACE clauses, so the database creates an Oracle managed datafile for each of these tablespaces.
  • No TEMPFILE subclause is specified for the DEFAULT TEMPORARY TABLESPACE clause, so the database creates an Oracle managed tempfile.
  • If no CONTROL_FILES initialization 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 TABLESPACEDEFAULT TABLESPACE子句指定DATAFILE子句,因此数据库为每个这些表空间创建一个Oracle托管数据文件。
  • 没有为DEFAULT TEMPORARY TABLESPACE子句指定TEMPFILE子句,因此数据库创建一个Oracle托管的临时文件。
  • 如果在初始化参数文件中未指定CONTROL_FILES初始化参数,则数据库还将创建一个Oracle托管控制文件。

 

Supporting Bigfile Tablespaces During Database Creation

Oracle Database simplifies management of tablespaces and enables support for ultra-large databases by letting you create bigfile tablespaces. Bigfile tablespaces 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 to 64K files). Therefore, bigfile tablespaces can significantly enhance the storage capacity of an Oracle Database.

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

This section discusses the clauses of the CREATE DATABASE statement that let you include support for bigfile tablespaces.

See Also:

"Bigfile Tablespaces" for more information about bigfile tablespaces

Specifying the Default Tablespace Type

The SET DEFAULT...TABLESPACE clause of the CREATE DATABASE statement determines the default type of tablespace for this database in subsequent CREATETABLESPACE statements. Specify either SET DEFAULT BIGFILE TABLESPACE or SET DEFAULT SMALLFILE TABLESPACE. If you omit this clause, then the default is asmallfile tablespace, which is the traditional type of Oracle Database tablespace. A smallfile tablespace can contain up to 1022 files with up to 4M blocks each.

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

The use of bigfile tablespaces further enhances the Oracle Managed Files feature, because bigfile tablespaces make datafiles completely transparent for users. SQL syntax for the ALTER TABLESPACE statement has been extended to allow you to perform operations on tablespaces, rather than the underlying datafiles.

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

The CREATE DATABASE statement shown in "Specifying Oracle Managed Files at Database Creation" can be modified as follows to specify that the default type of tablespace is a bigfile tablespace:

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

CREATE DATABASE mynewdb

     USER SYS IDENTIFIED BY sys_password

     USER SYSTEM IDENTIFIED BY system_password

     SET DEFAULT BIGFILE TABLESPACE

     UNDO TABLESPACE undotbs

     DEFAULT TEMPORARY TABLESPACE tempts1;

To dynamically change the default tablespace type after database creation, use the SET DEFAULT TABLESPACE clause of the ALTER DATABASE statement:

ALTER DATABASE SET DEFAULT BIGFILE TABLESPACE;

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

You can determine the current default tablespace type for the database by querying the DATABASE_PROPERTIES data dictionary view as follows:

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

SELECT PROPERTY_VALUE FROM DATABASE_PROPERTIES

   WHERE PROPERTY_NAME = 'DEFAULT_TBS_TYPE';


Overriding the Default Tablespace Type

The SYSTEM and SYSAUX tablespaces are always created with the default tablespace type. However, you can explicitly override the default tablespace type for theUNDO and DEFAULT TEMPORARY tablespace during the CREATE DATABASE operation.

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

 

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

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

CREATE DATABASE mynewdb

...

     BIGFILE UNDO TABLESPACE undotbs

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

        SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

You can create a smallfile DEFAULT TEMPORARY tablespace in a database with the default tablespace type of bigfile as follows:

CREATE DATABASE mynewdb

   SET DEFAULT BIGFILE TABLESPACE

...

     SMALLFILE DEFAULT TEMPORARY TABLESPACE tempts1

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

        SIZE 20M REUSE

...


Specifying the Database Time Zone and Time Zone File

This section contains:

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

Setting the Database Time Zone

Set the database time zone when the database is created by using the SET TIME_ZONE clause of the CREATE DATABASE statement. If you do not set the database time zone, then it defaults to the time zone of the host operating system.

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

You can change the database time zone for a session by using the SET TIME_ZONE clause of the ALTER SESSION statement.

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

See Also:

Oracle Database Globalization Support Guide for more information about setting the database time zone


About the Database Time Zone Files

Two time zone files are included in a subdirectory of the Oracle home directory. The time zone files contain the valid time zone names. The following 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 time zone file is ORACLE_HOME/oracore/zoneinfo/timezlrg_11.dat. A smaller 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 time zone names in the file being used by your database, use the following query:

SELECT * FROM V$TIMEZONE_NAMES;

See Also:

Oracle Database Globalization Support Guide for more information about managing and selecting time zone files

Specifying the Database Time Zone File

All databases that share information must use the same time zone datafile.

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

The database server always uses the large time zone file by default. If you would like to use the small time zone file on the client and know that all your data will refer only to regions in the small file, you can set the ORA_TZFILE environment variable on the client to the full path name of the timezone_version.dat file on the client, where version matches the time zone file version that is being used by the database server.

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

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

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


Specifying FORCE LOGGING Mode

Some data definition language statements (such as CREATE TABLE) allow the NOLOGGING clause, which causes some database operations not to generate redo records in the database redo log. The NOLOGGING setting can speed up operations that can be easily recovered outside of the database recovery mechanisms, but it can negatively affect media recovery and standby databases.

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

Oracle Database lets you force the writing of redo records even when NOLOGGING has been specified in DDL statements. The database never generates redo records for temporary tablespaces and temporary segments, so forced logging has no affect for objects.

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

See Also:

Oracle Database SQL Language Reference for information about operations that can be done in NOLOGGING mode

Using the FORCE LOGGING Clause

To put the database into FORCE LOGGING mode, use the FORCE LOGGING clause in the CREATE DATABASE statement. If you do not specify this clause, the database is not placed into FORCE LOGGING mode.

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

Use the ALTER DATABASE statement to place the database into FORCE LOGGING mode after database 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 can cancel FORCE LOGGING mode using the following SQL statement:

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

ALTER DATABASE NO FORCE LOGGING;

Independent of specifying FORCE LOGGING for the database, you can selectively specify FORCE LOGGING or NO FORCE LOGGING at the tablespace level. However, ifFORCE LOGGING mode is in effect for the database, it takes precedence over the tablespace setting. If it is not in effect for the database, then the individual tablespace settings are enforced. Oracle recommends that either the entire database is placed into FORCE LOGGING mode, or individual tablespaces be placed into FORCE LOGGING mode, but not both.

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

The FORCE LOGGING mode is a persistent attribute of the database. That is, if the database is shut down and restarted, it remains in the same logging mode. However, if you re-create the control file, the database is not restarted in the FORCE LOGGING mode unless you specify the FORCE LOGGING clause in the CREATE CONTROL FILE statement.

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

See Also:

"Controlling the Writing of Redo Records" for information about using the FORCE LOGGING clause for tablespace creation.


Performance Considerations of 
FORCE LOGGING Mode

FORCE LOGGING mode results in some performance degradation. If the primary reason for specifying FORCE LOGGING is to ensure complete media recovery, and there is no standby database active, then consider 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 database is running in NOARCHIVELOG mode, then generally there is no benefit to placing the database in FORCE LOGGING mode. Media recovery is not possible in NOARCHIVELOG mode, so if you combine it with FORCE LOGGING, the result may be performance degradation with little benefit.

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

 

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

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI