【翻譯】Specifying CREATE DATABASE Statement Clauses

迷倪小魏發表於2017-08-23


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

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:

·          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

·        

·        

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 .

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

如果為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 .

See Also:

在建立資料庫時建立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:

·        

·         , 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:

 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 .

當指定本地管理的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:

 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 ), 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:

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

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:

 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:

 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:

 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:

 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(苦練七十二變,笑對八十一難)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31015730/viewspace-2143978/,如需轉載,請註明出處,否則將追究法律責任。

相關文章