溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

【翻譯】Specifying CREATE DATABASE Statement Clauses

發(fā)布時(shí)間:2020-08-14 08:03:51 來(lái)源:ITPUB博客 閱讀:238 作者:迷倪小魏 欄目:關(guān)系型數(shù)據(jù)庫(kù)


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:

執(zhí)行CREATE DATABASE語(yǔ)句時(shí),Oracle數(shù)據(jù)庫(kù)將執(zhí)行多個(gè)操作。 執(zhí)行的實(shí)際操作取決于您在CREATE DATABASE語(yǔ)句中指定的子句和您設(shè)置的初始化參數(shù)。 Oracle數(shù)據(jù)庫(kù)至少執(zhí)行以下操作:

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

如果省略這些子句,則分別為這些用戶(hù)分配默認(rèn)密碼change_on_installmanager 將一條記錄寫(xiě)入警報(bào)日志,指示使用了默認(rèn)密碼。 為了保護(hù)數(shù)據(jù)庫(kù),您必須在數(shù)據(jù)庫(kù)創(chuàng)建后立即使用ALTER USER語(yǔ)句更改這些密碼。

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強(qiáng)烈推薦指定這些子句,即使在此版本的Oracle數(shù)據(jù)庫(kù)中它們是可選的。 默認(rèn)密碼是眾所周知的,如果稍后忽略更改密碼,則會(huì)使數(shù)據(jù)庫(kù)容易受到惡意用戶(hù)的攻擊。

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.

選擇密碼時(shí),請(qǐng)記住,從11g版開(kāi)始,密碼區(qū)分大小寫(xiě)。此外,你的數(shù)據(jù)庫(kù)可能存在密碼格式化要求。

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語(yǔ)句中指定EXTENT MANAGEMENT LOCAL子句,以創(chuàng)建本地管理的SYSTEM表空間。 COMPATIBLE初始化參數(shù)必須設(shè)置為10.0.0或更高才能使此語(yǔ)句成功。 如果不指定EXTENT MANAGEMENT LOCAL子句,則默認(rèn)情況下,數(shù)據(jù)庫(kù)將創(chuàng)建一個(gè)字典管理的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表空間創(chuàng)建數(shù)據(jù)庫(kù),并且如果不使用Oracle Managed Files,那么請(qǐng)確保滿(mǎn)足以下條件:

  • 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表空間始終在創(chuàng)建數(shù)據(jù)庫(kù)時(shí)創(chuàng)建。 SYSAUX表空間用作SYSTEM表空間的輔助表空間。 因?yàn)樗且郧靶枰约旱谋砜臻g的許多Oracle數(shù)據(jù)庫(kù)功能和產(chǎn)品的默認(rèn)表空間,因此可以減少數(shù)據(jù)庫(kù)所需的表空間數(shù)量。 它還減少了SYSTEM表空間的負(fù)載。

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語(yǔ)句中的SYSAUX DATAFILE子句來(lái)指定SYSAUX表空間的數(shù)據(jù)文件屬性。 SYSAUX表空間的必需屬性由Oracle數(shù)據(jù)庫(kù)設(shè)置,包括:

  • 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語(yǔ)句更改這些屬性,任何嘗試都會(huì)導(dǎo)致錯(cuò)誤。您不能刪除或重命名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的數(shù)據(jù)庫(kù)組件的大小決定。你可以通過(guò)查詢(xún)V$SYSAUX_OCCUPANTS視圖來(lái)查看這些組件的列表。根據(jù)這些組件的初始大小,在創(chuàng)建數(shù)據(jù)庫(kù)時(shí),SYSAUX表空間必須至少為400 MB。數(shù)據(jù)庫(kù)完全部署后,SYSAUX表空間的空間要求將會(huì)增加,這取決于其使用和工作負(fù)載的性質(zhì)。

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語(yǔ)句將失敗。如果啟用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"

在創(chuàng)建數(shù)據(jù)庫(kù)時(shí)創(chuàng)建SYSAUX數(shù)據(jù)庫(kù)。的、在Oracle數(shù)據(jù)庫(kù)版本進(jìn)行升級(jí)時(shí),從不需要SYSAUX表空間,必須在升級(jí)過(guò)程中創(chuàng)建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.

自動(dòng)undo管理使用undo表空間。 要啟用自動(dòng)undo管理,請(qǐng)?jiān)诔跏蓟瘏?shù)文件中將UNDO_MANAGEMENT初始化參數(shù)設(shè)置為AUTO。 或者,省略此參數(shù),11g數(shù)據(jù)庫(kù)默認(rèn)為自動(dòng)undo管理。 在此模式下,undo數(shù)據(jù)存儲(chǔ)在undo表空間中,由Oracle數(shù)據(jù)庫(kù)管理。 要自己定義和命名undo表空間,必須在數(shù)據(jù)庫(kù)創(chuàng)建時(shí)將CROTE DATABASE語(yǔ)句中包含UNDO TABLESPACE子句。 如果省略此子句,并啟用自動(dòng)undo管理,則數(shù)據(jù)庫(kù)將創(chuàng)建一個(gè)名為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語(yǔ)句中的DEFAULT TABLESPACE子句指定數(shù)據(jù)庫(kù)的默認(rèn)永久表空間。 Oracle數(shù)據(jù)庫(kù)為此表空間分配任何未明確指定不同永久表空間的非SYSTEM用戶(hù)。 如果不指定此子句,則SYSTEM表空間是非SYSTEM用戶(hù)的默認(rèn)永久表空間。 Oracle強(qiáng)烈建議創(chuàng)建一個(gè)默認(rèn)的永久表空間。

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語(yǔ)句的DEFAULT TEMPORARY TABLESPACE子句創(chuàng)建數(shù)據(jù)庫(kù)的默認(rèn)臨時(shí)表空間。 Oracle數(shù)據(jù)庫(kù)將這個(gè)表空間分配給沒(méi)有顯式分配臨時(shí)表空間的用戶(hù)。

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語(yǔ)句中為用戶(hù)顯式分配臨時(shí)表空間或表空間組。 但是,如果不這樣做,并且如果沒(méi)有為數(shù)據(jù)庫(kù)指定默認(rèn)臨時(shí)表空間,那么默認(rèn)情況下,這些用戶(hù)將被分配為SYSTEM表空間作為它們的臨時(shí)表空間。 SYSTEM表空間中存儲(chǔ)臨時(shí)數(shù)據(jù)是不好的做法,分配每個(gè)用戶(hù)一個(gè)臨時(shí)表空間是麻煩的。 因此,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".

當(dāng)指定本地管理的SYSTEM表空間時(shí),SYSTEM表空間不能用作臨時(shí)表空間。 在這種情況下,您必須創(chuàng)建一個(gè)默認(rèn)的臨時(shí)表空間。

 

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.

你可以通過(guò)使用Oracle托管文件功能來(lái)最小化你在CREATE DATABASE語(yǔ)句中指定的子句和參數(shù)數(shù)??梢酝ㄟ^(guò)指定由Oracle數(shù)據(jù)庫(kù)創(chuàng)建和管理文件的目錄或Oracle自動(dòng)存儲(chǔ)管理(Oracle ASM)磁盤(pán)組來(lái)執(zhí)行該操作。

 

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:

通過(guò)在初始化參數(shù)文件中設(shè)置初始化參數(shù)DB_CREATE_FILE_DEST,DB_CREATE_ONLINE_LOG_DEST_nDB_RECOVERY_FILE_DEST,可以指導(dǎo)Oracle數(shù)據(jù)庫(kù)創(chuàng)建和管理數(shù)據(jù)庫(kù)的底層操作系統(tǒng)文件。 Oracle數(shù)據(jù)庫(kù)將自動(dòng)創(chuàng)建和管理以下數(shù)據(jù)庫(kù)結(jié)構(gòu)的操作系統(tǒng)文件,具體取決于你指定的初始化參數(shù)以及在CREATE DATABASE語(yǔ)句中指定子句:

  • 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語(yǔ)句簡(jiǎn)要說(shuō)明了Oracle托管文件功能的工作原理,假設(shè)您已經(jīng)指定了所需的初始化參數(shù):

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表空間創(chuàng)建為本地管理的表空間。沒(méi)有EXTENT MANAGEMENT LOCAL子句,SYSTEM表空間創(chuàng)建為字典管理,不推薦。
  • 沒(méi)有指定DATAFILE子句,因此數(shù)據(jù)庫(kù)為SYSTEM表空間創(chuàng)建一個(gè)Oracle托管數(shù)據(jù)文件。
  • 不包括LOGFILE子句,因此數(shù)據(jù)庫(kù)創(chuàng)建兩個(gè)Oracle管理的重做日志文件組。
  • 不包括SYSAUX DATAFILE,因此數(shù)據(jù)庫(kù)為SYSAUX表空間創(chuàng)建一個(gè)Oracle托管數(shù)據(jù)文件。
  • 沒(méi)有為UNDO TABLESPACEDEFAULT TABLESPACE子句指定DATAFILE子句,因此數(shù)據(jù)庫(kù)為每個(gè)這些表空間創(chuàng)建一個(gè)Oracle托管數(shù)據(jù)文件。
  • 沒(méi)有為DEFAULT TEMPORARY TABLESPACE子句指定TEMPFILE子句,因此數(shù)據(jù)庫(kù)創(chuàng)建一個(gè)Oracle托管的臨時(shí)文件。
  • 如果在初始化參數(shù)文件中未指定CONTROL_FILES初始化參數(shù),則數(shù)據(jù)庫(kù)還將創(chuàng)建一個(gè)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數(shù)據(jù)庫(kù)簡(jiǎn)化了表空間的管理,并通過(guò)創(chuàng)建bigfile表空間來(lái)支持超大型數(shù)據(jù)庫(kù)。 Bigfile表空間只能包含一個(gè)數(shù)據(jù)文件,但該文件最多可以擁有4G的塊。 Oracle數(shù)據(jù)庫(kù)中的最大數(shù)據(jù)文件數(shù)量有限(通常為64K文件)。 因此,bigfile表空間可以顯著增強(qiáng)Oracle數(shù)據(jù)庫(kù)的存儲(chǔ)容量。

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語(yǔ)句的SET DEFAULT ... TABLESPACE子句決定CREATE TABLESPACE語(yǔ)句中表空間的默認(rèn)類(lèi)型。 指定SET DEFAULT BIGFILE TABLESPACESET DEFAULT SMALLFILE TABLESPACE 如果省略此子句,那么默認(rèn)是一個(gè)smallfile表空間,它是傳統(tǒng)類(lèi)型的Oracle數(shù)據(jù)庫(kù)表空間。 一個(gè)smallfile表空間最多可以包含1022個(gè)文件,最多可以有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表空間進(jìn)一步增強(qiáng)了Oracle Managed Files功能,因?yàn)?/span>bigfile表空間使數(shù)據(jù)文件對(duì)用戶(hù)完全透明。 已經(jīng)擴(kuò)展了ALTER TABLESPACE語(yǔ)句的SQL語(yǔ)法,允許對(duì)表空間執(zhí)行操作,而不是數(shù)據(jù)文件。

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:

“數(shù)據(jù)庫(kù)創(chuàng)建時(shí)指定Oracle托管文件”中CREATE DATABASE語(yǔ)句可以修改如下,以指定默認(rèn)類(lèi)型的表空間是一個(gè)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;

要在創(chuàng)建數(shù)據(jù)庫(kù)后動(dòng)態(tài)更改默認(rèn)表空間類(lèi)型,請(qǐng)使用ALTER DATABASE語(yǔ)句的SET DEFAULT TABLESPACE子句:

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

你可以通過(guò)查詢(xún)DATABASE_PROPERTIES數(shù)據(jù)字典視圖來(lái)確定數(shù)據(jù)庫(kù)的當(dāng)前缺省表空間類(lèi)型,如下所示:

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表空間始終使用默認(rèn)表空間類(lèi)型創(chuàng)建。 但是,你可以在CREATE DATABASE時(shí)顯式覆蓋UNDO和DEFAULT TEMPORARY表空間的默認(rèn)表空間類(lèi)型。

 

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

例如,你可以在數(shù)據(jù)庫(kù)中創(chuàng)建一個(gè)bigfile UNDO表空間,其默認(rèn)表空間類(lèi)型為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語(yǔ)句的SET TIME_ZONE子句創(chuàng)建數(shù)據(jù)庫(kù)時(shí)設(shè)置數(shù)據(jù)庫(kù)時(shí)區(qū)。 如果不設(shè)置數(shù)據(jù)庫(kù)時(shí)區(qū),則默認(rèn)為主機(jī)操作系統(tǒng)的時(shí)區(qū)。

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

你可以使用ALTER SESSION語(yǔ)句的SET TIME_ZONE子句更改會(huì)話的數(shù)據(jù)庫(kù)時(shí)區(qū)。

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:

兩個(gè)時(shí)區(qū)文件包含在Oracle主目錄的子目錄中。 時(shí)區(qū)文件包含有效的時(shí)區(qū)名稱(chēng)。 每個(gè)時(shí)區(qū)也包括以下信息:

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

默認(rèn)時(shí)區(qū)文件為$ORACLE_HOME / oracore / zoneinfo / timezlrg_11.dat。 $ORACLE_HOME / oracore / zoneinfo / timezone_11.dat中可以找到較小時(shí)區(qū)文件。

 

要查看數(shù)據(jù)庫(kù)使用的文件中的時(shí)區(qū)名稱(chēng),請(qǐng)使用以下查詢(xún)

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.

共享信息的所有數(shù)據(jù)庫(kù)必須使用相同的時(shí)區(qū)數(shù)據(jù)文件。

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.

數(shù)據(jù)庫(kù)服務(wù)器默認(rèn)使用大時(shí)區(qū)文件。 如果在客戶(hù)端上要使用小時(shí)區(qū)文件,并且知道所有數(shù)據(jù)只能引用小文件中的區(qū)域,則可以將客戶(hù)端上的ORA_TZFILE環(huán)境變量設(shè)置為timezone_version.dat的完整路徑名,其中版本要與數(shù)據(jù)庫(kù)服務(wù)器正在使用的時(shí)區(qū)文件版本相匹配。

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.

如果你已經(jīng)在客戶(hù)端上使用默認(rèn)較大的時(shí)區(qū)文件,那么更改為較小的時(shí)區(qū)文件是不切實(shí)際的,因?yàn)閿?shù)據(jù)庫(kù)可能包含不屬于較小文件的時(shí)區(qū)的數(shù)據(jù)。


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.

一些數(shù)據(jù)定義語(yǔ)言語(yǔ)句(例如CREATE TABLE)允許NOLOGGING子句,這導(dǎo)致一些數(shù)據(jù)庫(kù)操作不會(huì)在數(shù)據(jù)庫(kù)redo日志中生成重做記錄。 NOLOGGING設(shè)置可以加快在數(shù)據(jù)庫(kù)恢復(fù)機(jī)制之外輕松恢復(fù)的操作,但會(huì)對(duì)介質(zhì)恢復(fù)和備用數(shù)據(jù)庫(kù)產(chǎn)生負(fù)面影響。

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語(yǔ)句中指定了NOLOGGING,Oracle數(shù)據(jù)庫(kù)也可以強(qiáng)制寫(xiě)入redo記錄。 數(shù)據(jù)庫(kù)從不為臨時(shí)表空間和臨時(shí)段生成重做記錄,因此強(qiáng)制日志對(duì)對(duì)象沒(méi)有影響。

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.

要將數(shù)據(jù)庫(kù)置于FORCE LOGGING模式,請(qǐng)?jiān)?/span>CREATE DATABASE語(yǔ)句中使用FORCE LOGGING子句。 如果不指定此子句,數(shù)據(jù)庫(kù)不會(huì)被置于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.

數(shù)據(jù)庫(kù)創(chuàng)建后,使用ALTER DATABASE語(yǔ)句將數(shù)據(jù)庫(kù)置于FORCE LOGGING模式。 此語(yǔ)句可能需要相當(dāng)長(zhǎng)的時(shí)間來(lái)完成,因?yàn)樗却形磳?xiě)入的寫(xiě)入才能完成。

You can cancel FORCE LOGGING mode using the following SQL statement:

您可以使用以下SQL語(yǔ)句取消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.

獨(dú)立于數(shù)據(jù)庫(kù)來(lái)指定FORCE LOGGING,你可以在表空間級(jí)別選擇性地指定FORCE LOGGINGNO FORCE LOGGING 但是,如果FORCE LOGGING模式對(duì)數(shù)據(jù)庫(kù)有效,則優(yōu)先于表空間設(shè)置。 如果數(shù)據(jù)庫(kù)不起作用,則會(huì)強(qiáng)制執(zhí)行各個(gè)表空間設(shè)置。 Oracle推薦將整個(gè)數(shù)據(jù)庫(kù)放入FORCE LOGGING模式,否則將各個(gè)表空間置于FORCE LOGGING模式中,但不能同時(shí)置入。

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模式是數(shù)據(jù)庫(kù)的持久屬性。 也就是說(shuō),如果數(shù)據(jù)庫(kù)被關(guān)閉并重新啟動(dòng),它將保持在相同的日志記錄模式。 但是,如果重新創(chuàng)建控制文件,除非在CREATE CONTROL FILE語(yǔ)句中指定了FORCE LOGGING子句,否則數(shù)據(jù)庫(kù)不會(huì)在FORCE LOGGING模式下重新啟動(dòng)。

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模式導(dǎo)致性能下降。 如果指定FORCE LOGGING的主要原因是確保完整的介質(zhì)恢復(fù),并且沒(méi)有備用數(shù)據(jù)庫(kù)處于活動(dòng)狀態(tài),那么請(qǐng)考慮以下幾點(diǎn):

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

·         多少媒體故障可能會(huì)發(fā)生?

·         直接寫(xiě)入無(wú)法恢復(fù)時(shí),損壞程度如何?

·         強(qiáng)制記錄是否容忍性能下降?

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.

如果數(shù)據(jù)庫(kù)以NOARCHIVELOG模式運(yùn)行,那么一般來(lái)說(shuō),將數(shù)據(jù)庫(kù)置于FORCE LOGGING模式下通常沒(méi)有任何好處。 NOARCHIVELOG模式下,介質(zhì)恢復(fù)是不可能的,因此如果將其與強(qiáng)制登錄結(jié)合使用,結(jié)果可能會(huì)降低性能,而且效果不大。

 

作者:SEian.G(苦練七十二變,笑對(duì)八十一難)

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI