【跟我学oracle18c】第二十五天:Multitenant :15 管理PDBs
15 Administering PDBs
管理PDBs包括连接到PDB、修改PDB和管理与PDBs关联的服务等任务。
Note:
您可以使用SQL*Plus或Oracle SQL Developer完成本章中的任务。要了解如何使用Oracle Enterprise Manager Cloud Control (Cloud Control)管理PDBs, see "Administering PDBs with Cloud Control".
This chapter contains the following topics:
- About PDB Administration
Administering a pluggable database (PDB) involves a subset of the tasks required to administer a non-CDB. - Managing Connections to a PDB
You manage connections for a PDB in the same way as for a non-CDB, with some special considerations. - Modifying a PDB at the System Level
You can use theALTER SYSTEM
statement to modify a PDB. - Modifying a PDB at the Database Level
You can modify a PDB using theALTER PLUGGABLE DATABASE
statement. - Starting Up and Shutting Down a PDB
When the current container is a PDB, you can use the SQL*PlusSTARTUP
command to open the PDB and the SQL*PlusSHUTDOWN
command to close the PDB.
Related Topics
- Tools for a Multitenant Environment
Parent topic: Administering a Multitenant Environment
15.1 About PDB Administration
管理可插入数据库(PDB)涉及管理非cdb所需任务的子集。
在这个任务子集中,PDB和非cdb的大部分任务是相同的,但是存在差异。例如,当您修改PDB的open模式时,会有一些差异。此外,PDB管理员只能管理单个PDB,不能管理多租户容器数据库(CDB)中的其他PDB。
This section contains the following topics:
- Tasks Common to PDBs and Non-CDBs
Most administrative tasks are the same for a PDB and a non-CDB. - Tasks Specific to CDBs
Some administrative tasks cannot be performed when the current container is a PDB.
See Also:
"Modifying a PDB at the Database Level" for more information about changing the open mode of the current PDB
Parent topic: Administering PDBs
15.1.1PDBs和非cdbs常见的任务
对于PDB和非cdb,大多数管理任务是相同的。
在管理PDB时,可以使用ALTER数据库、ALTER PLUGGABLE数据库或ALTER SYSTEM语句修改PDB。还可以在PDB上执行DDL语句。下表描述了PDB和非cdb常见的一些任务。
Table 15-1 Administrative Tasks Common to PDBs and Non-CDBs
Task | Description | Additional Information |
---|---|---|
Managing tablespaces |
You can create, modify, and drop tablespaces for a PDB. You can specify a default tablespace and default tablespace type for each PDB. Also, there is a default temporary tablespace for each PDB. You optionally can create additional temporary tablespaces for use by individual PDBs. |
"Modifying a PDB at the Database Level" Oracle Database Administrator’s Guide for information about managing tablespaces |
Managing data files and temp files |
Each PDB has its own data files. You can manage data files and temp files in the same way that you would manage them for a non-CDB. You can also limit the amount of storage used by the data files for a PDB by using the |
"Modifying a PDB at the Database Level" Oracle Database Administrator’s Guide for information about managing data files and temp files |
Managing schema objects |
You can create, modify, and drop schema objects in a PDB in the same way that you would in a non-CDB. You can also create triggers that fire for a specific PDB. When you manage database links in a CDB, the root has a unique global database name, and so does each PDB. The global name of the root is defined by the |
Oracle Database Administrator’s Guide for more information about schema objects Oracle Database Administrator’s Guide Oracle Database PL/SQL Language Reference for information about creating triggers in a CDB |
Parent topic: About PDB Administration
15.1.2 特定于CDBs的任务
当当前容器为PDB时,无法执行某些管理任务。
当当前容器为根时,由一个普通用户为整个CDB或CDB根执行以下任务:
Starting up and shutting down a CDB instance
Modifying the CDB or the root with an
ALTER DATABASE
statementModifying the CDB or the root with an
ALTER SYSTEM
statementExecuting data definition language (DDL) statements on a CDB or the root
Managing the following components:
Processes
Memory
Errors and alerts
Diagnostic data
Control files
The online redo log and the archived redo log files
Undo
Creating, plugging in, unplugging, and dropping PDBs
当前容器为根的普通用户还可以更改一个或多个PDBs的打开模式。类似地,当前容器为PDB的acommon用户或本地用户可以更改当前PDB的打开模式。
See Also:
"About the Current Container"
"Administering a CDB" for more information about this task and other tasks related to administering a CDB or the root
Parent topic: About PDB Administration
15.2 Managing Connections to a PDB
您管理PDB连接的方式与管理非cdb连接的方式相同,但有一些特殊的注意事项。
This section contains the following topics:
- Connecting to a PDB
You can use several techniques to connect to a PDB with the SQL*PlusCONNECT
command. - Managing Services for PDBs
You can create, modify, or remove services for a PDB. - Modifying the Listener Settings of a Referenced PDB
A PDB that is referenced by a proxy PDB is called a referenced PDB.
Parent topic: Administering PDBs
15.2.1 Connecting to a PDB
使用SQL*Plus connect命令可以使用几种技术连接到PDB。
本节假设您了解如何在SQL*Plus中连接到非cdb。
您可以使用以下技术连接到一个PDB与SQL*Plus连接命令:
Local connection with operating system authentication
Database connection using easy connect
Database connection using a net service name
Prerequisites
The following prerequisites must be met:
The user connecting to the PDB must be granted the
CREATE SESSION
privilege in the PDB.To connect to a PDB as a user that does not have
SYSDBA
,SYSOPER
,SYSBACKUP
, orSYSDG
administrative privilege, the PDB must be open.
Note:
This section assumes that the user connecting to the PDB using a local user account. You can also connect to the PDB as a common user, and you can connect to the root as a common user and switch to the PDB.
To connect to a PDB using the SQL*Plus CONNECT command:
Configure your environment so that you can open SQL*Plus.
Start SQL*Plus with the
/NOLOG
argument:sqlplus /nolog
Issue a
CONNECT
command using easy connect or a net service name to connect to the PDB.To connect to a PDB, connect to a service with a
PDB
property.
Example 15-1 Connecting to a PDB in SQL*Plus Using the PDB's Net Service Name
The following command connects to the hr
user using the hrapp
service. The hrapp
service has a PDB
property for the hrpdb
PDB. This example assumes that the client is configured to have a net service name for the hrapp
service.
CONNECT hr@hrapp
See Also:
"Modifying the Open Mode of One or More PDBs" and "Modifying a PDB at the Database Level"for information about changing the open mode of a PDB.
"About Container Access in a CDB" for information about connecting to a PDB as a common user
"Managing Services for PDBs"
Oracle Database Administrator’s Guide for information about connecting to the database with SQL*Plus
Parent topic: Managing Connections to a PDB
15.2.2 Managing Services for PDBs
This section contains the following topics:
- About Services for PDBs
Each PDB has a default service, but you can create your own using SRVCTL orDBMS_SERVICE
. - Managing Services for a PDB Using SRVCTL and DBMS_SERVICE
You can create, modify, or remove a service with aPDB
property.
Oracle Database Administrator’s Guide
Parent topic: Managing Connections to a PDB
15.2.2.1 About Services for PDBs
每个PDB都有一个默认服务,但是您可以使用SRVCTL或DBMS_SERVICE创建自己的服务。
This section contains the following topics:
- The PDB Property
ThePDB
property associates a service with a PDB. When a client connects to a service with aPDB
property, the current container for the connection is the PDB. - Default and User-Defined Services
Creating a PDB creates a new default service for the PDB automatically. - Tools for Managing Services
Oracle recommends using the SRVCTL utility to create and modify services. Alternatively, you can use theDBMS_SERVICE
package.
Parent topic: Managing Services for PDBs
15.2.2.1.1 The PDB Property
PDB属性将服务与PDB关联。当客户端使用PDBproperty连接到服务时,连接的当前容器是PDB。
The PDB
property is required only when you do either of the following:
Create a service
Modify the
PDB
property of a service
You do not specify a PDB
property when you start, stop, or remove a service. Also, you do not need to specify a PDB
property when you modify a service without modifying its PDB
property.
You can view the PDB
property for a service by querying the ALL_SERVICES
data dictionary view. Alternatively, when using the SRVCTL utility, you can use the srvctl config service
command.
See Also:
"About the Current Container"
Parent topic: About Services for PDBs
15.2.2.1.2 Default and User-Defined Services
创建PDB将自动为PDB创建一个新的默认服务。
在CDB中,每个数据库服务名称必须是惟一的,并且每个数据库服务名称必须在其实例通过特定侦听器到达的所有CDBs范围内是惟一的。默认服务的名称与PDB相同。您无法管理此服务,该服务仅应用于管理任务。
始终为应用程序使用用户定义的服务。原因是您可以自定义用户定义的服务来满足应用程序的需求。Oracle建议您不要对应用程序使用默认的PDB服务。
Note:
Do not associate a service with a proxy PDB.
In an Oracle Clusterware environment, you must create an Oracle Clusterware resource for each service that is created for the PDB. When your database is being managed by Oracle Restart or Oracle Clusterware, and when you use the SRVCTL utility to start a service with a PDB property for a PDB that is closed, the PDB is opened in read/write mode on the nodes where the service is started. However, stopping a PDB service does not change the open mode of the PDB.
When you unplug or drop a PDB, the services of the unplugged or dropped PDB are not removed automatically. You can remove these services manually.
See Also:
"Modifying a PDB with the ALTER PLUGGABLE DATABASE Statement" for information about changing the open mode of a PDB
"Creating a Proxy PDB That References an Application Root Replica"
Parent topic: About Services for PDBs
15.2.2.1.3 Tools for Managing Services
Oracle建议使用SRVCTL实用程序创建和修改服务。或者,您可以使用DBMS_SERVICE包。
SRVCTL
如果您的单实例数据库由Oracle Restart管理,或者Oracle RAC数据库由Oracle Clusterware管理,那么请使用服务器控件(SRVCTL)实用程序创建、修改或删除服务。
要使用SRVCTL实用程序为PDB创建服务,请使用add service命令并在-pdb参数中指定PDB。如果不指定-pdb,则服务与根关联。
要使用SRVCTL实用程序修改服务的PDB属性,请使用modify servicecommand并在-pdb参数中指定PDB。要使用SRVCTL实用程序为PDB删除服务,请使用remove服务命令。
您可以使用其他SRVCTL命令来管理服务,例如启动服务、停止服务和重新定位服务命令,即使它们不包含-pdb参数。
使用SRVCTL实用程序创建或修改服务时,不会验证PDB名称。但是,尝试使用无效的PDB名称启动服务将导致错误。
DBMS_SERVICE
如果数据库不是由Oracle Restart或Oracle Clusterware管理,则使用DBMS_SERVICE包创建或删除数据库服务。
DBMS_SESSION存在于根级别和每个PDB中。它由SYS在每个级别上拥有和执行。对于另一个PDB拥有的服务,PDB管理员不能停止、重新定位或测试连接。
当您使用DBMS_SERVICE包创建服务时,服务的PDB属性被设置为当前容器。因此,要使用DBMS_SERVICE包创建一个PDB属性设置为特定PDB的服务,请在PDB是当前容器时运行CREATE_SERVICE过程。如果您在当前容器是根容器时使用CREATE_SERVICE过程创建服务,那么该服务将与根关联。
不能使用DBMS_SERVICE包修改服务的PDB属性。但是,您可以在一个PDB中删除服务,并在另一个PDB中创建类似的服务。在这种情况下,新服务具有创建它的PDB的PDB属性。
您还可以使用其他DBMS_SERVICE子程序来管理服务,例如START_SERVICE和STOP_SERVICE过程。您可以使用DBMS_SERVICE。在计划维护期间检查数据库连接的健康状态的_CONNECTION_TEST过程。使用DELETE_SERVICE过程删除服务。
See Also:
"Example 19-9"
Oracle Database Administrator’s Guide for information about configuring automatic restart of an Oracle database
Oracle Database PL/SQL Packages and Types Reference for information about the
DBMS_SERVICE
packageOracle Database 2 Day + Real Application Clusters Guide and Oracle Real Application Clusters Administration and Deployment Guide for information about creating services in an Oracle Real Application Clusters (Oracle RAC) environment
Parent topic: About Services for PDBs
15.2.2.2 Managing Services for a PDB Using SRVCTL and DBMS_SERVICE
You can create, modify, or remove a service with a PDB
property.
To manage a service with a PDB property using the SRVCTL utility:
Log in to the host computer with the correct user account.
Ensure that you run SRVCTL from the correct Oracle home.
Perform one of the following operations:
To create or modify a service, run the
add service
command, and specify the PDB in the-pdb
parameter.To modify the
PDB
property of a service, run themodify service
command, and specify the PDB in the-pdb
parameter.To remove a service, run the
remove service
command.
To create or remove a service for a PDB using the DBMS_SERVICE package:
In SQL*Plus, ensure that the current container is a PDB.
See "Connecting to a PDB".
Run the appropriate subprogram in the
DBMS_SERVICE
package.
Note:
If your database is being managed by Oracle Restart or Oracle Clusterware, then use the SRVCTL utility to manage services. Do not use the DBMS_SERVICE
package.
Example 15-2 Creating a Service for a PDB Using the SRVCTL Utility
本例使用DB_UNIQUE_NAME mycdb在CDB中添加PDB salespdb的salesrep服务:
srvctl add service -db mycdb -service salesrep -pdb salespdb
Example 15-3 Modifying the PDB Property of a Service Using the SRVCTL Utility
本例使用DB_UNIQUE_NAME mycdb修改CDB中的salesrep服务,将该服务与hrpdb PDB关联:
srvctl modify service -db mycdb -service salesrep -pdb hrpdb
Example 15-4 Relocating a Service in Oracle RAC Using the SRVCTL Utility
您可以使用“重新定位服务”命令将服务从当前正在运行的Oracle RAC实例重新定位到它可以运行的另一个实例。这种技术既适用于管理员管理的数据库的服务,也适用于策略管理的数据库的单例服务。
下面的命令将服务svc1从当前运行的Oracle RAC实例cdb_inst1重定位到当前不运行的实例cdb_inst2:
srvctl relocate service db cdb service svc1 oldinst cdb_inst1 newinst cdb_inst2 –drain_timeout NNN –stopoption immediate
The following command performs the same operation for a policy-managed database:
srvctl relocate service db cdb service svc1 currentnode cdb_inst1 targetnode cdb_inst2 –drain_timeout NNN –stopoption immediate
Example 15-5 Removing a Service Using the SRVCTL Utility
This example removes the salesrep
service in the CDB with DB_UNIQUE_NAME
mycdb
:
srvctl remove service -db mycdb -service salesrep
Example 15-6 Creating a Service for a PDB Using the DBMS_SERVICE Package
This example creates the salesrep
service for the current PDB:
BEGINDBMS_SERVICE.CREATE_SERVICE(service_name => 'salesrep',network_name => 'salesrep.example.com');
END;
/
The PDB
property of the service is set to the current container. For example, if the current container is the salespdb
PDB, then the PDB property of the service is salespdb
.
Example 15-7 Removing a Service Using the DBMS_SERVICE Package
This example removes the salesrep
service in the current PDB.
BEGINDBMS_SERVICE.DELETE_SERVICE(service_name => 'salesrep');
END;
/
See Also:
"Example 19-9"
Oracle Database PL/SQL Packages and Types Reference for information about the
DBMS_SERVICE
packageOracle Database 2 Day + Real Application Clusters Guide and Oracle Real Application Clusters Administration and Deployment Guide for information about managing services in an Oracle Real Application Clusters (Oracle RAC) environment
Parent topic: Managing Services for PDBs
15.2.3 Modifying the Listener Settings of a Referenced PDB
由代理PDB引用的PDB称为引用PDB。
当被引用PDB的侦听器的端口或主机名发生更改时,您必须修改被引用PDB的侦听器设置,以便其代理PDBs继续正常工作。
This section contains the following topics:
- Altering the Listener Host Name of a Referenced PDB
When the host name of the listener for a referenced PDB changes, you must run anALTER PLUGGABLE DATABASE CONTAINERS HOST
statement to reset the host name of the referenced PDB so that its proxy PDBs continue to function properly. - Altering the Listener Port Number of a Referenced PDB
When the port number of the listener for a referenced PDB changes, you must run anALTER PLUGGABLE DATABASE CONTAINERS PORT
statement to reset the port number of the referenced PDB so that its proxy PDBs continue to function properly.
Related Topics
- Creating a PDB as a Proxy PDB
Parent topic: Managing Connections to a PDB
15.2.3.1 更改引用PDB的侦听器主机名
当被引用PDB的侦听器的主机名发生更改时,必须运行ALTER PLUGGABLE DATABASE CONTAINERS主机语句来重置被引用PDB的主机名,以便其代理PDBs继续正常工作。
代理PDB使用数据库链接在PDB创建期间与其引用的PDB建立通信。建立通信后,代理PDB不使用数据库链接直接与被引用的PDB通信,可以删除数据库链接。当被引用PDB的侦听器主机名发生更改时,每个代理PDB必须重新建立与其引用PDB的通信。
引用的PDB的侦听器主机名是一个数据库属性。设置后,可以通过查询DATABASE_PROPERTIES数据字典视图查看当前设置。
The current user must have the ALTER DATABASE
system privilege, and the privilege must be either commonly granted or locally granted in the PDB.
- In SQL*Plus, ensure that the current container is the referenced PDB.
See "Connecting to a PDB".
- Run an
ALTER PLUGGABLE DATABASE CONTAINERS HOST
statement and specify the new host name, or include theRESET
keyword to return the host name to its default setting, which is the host name of the referenced PDB. - Drop and re-create the proxy PDBs that reference the referenced PDB to restablish communication for each proxy PDB and its referenced PDB.
Example 15-8 Altering the Listener Host Name of a Referenced PDB
This example changes the host name for the referenced PDB to myhost.example.com
.
ALTER PLUGGABLE DATABASE CONTAINERS HOST='myhost.example.com';
Example 15-9 Resetting the Listener Host Name to the Default Value
This example resets the host name for the referenced PDB to its default value. The default value is the host name of the referenced PDB.
ALTER PLUGGABLE DATABASE CONTAINERS HOST RESET;
See Also:
"Creating a PDB as a Proxy PDB"
"HOST Clause"
Parent topic: Modifying the Listener Settings of a Referenced PDB
15.2.3.2 更改引用PDB的侦听器端口号
当引用PDB的侦听器的端口号发生更改时,必须运行ALTER PLUGGABLE DATABASE CONTAINERS port语句来重置引用PDB的端口号,以便其代理PDBs继续正常工作。
代理PDB使用数据库链接在PDB创建期间与其引用的PDB建立通信。建立通信后,代理PDB不使用数据库链接直接与被引用的PDB通信,可以删除数据库链接。当被引用PDB的侦听器端口号发生变化时,每个代理PDB必须与其引用的PDB重新建立通信。
引用的PDB的侦听器端口号是数据库属性。设置后,可以通过查询DATABASE_PROPERTIES数据字典视图查看当前设置。
The current user must have the ALTER
DATABASE
system privilege, and the privilege must be either commonly granted or locally granted in the PDB.
- In SQL*Plus, ensure that the current container is the referenced PDB.
- Run an
ALTER PLUGGABLE DATABASE CONTAINERS PORT
statement and specify the new port number, or include theRESET
keyword to return the port number to its default setting, which is 1521. - Drop and re-create the proxy PDBs that reference the referenced PDB to re-establish communication for each proxy PDB and its referenced PDB.
Example 15-10 Altering the Listener Port Number of a Referenced PDB
This example changes the port number for the referenced PDB to 1543
.
ALTER PLUGGABLE DATABASE CONTAINERS PORT=1543;
Example 15-11 Resetting the Listener Port Number to the Default Value
This example resets the port number for the referenced PDB to its default value. The default value for the port number is 1521.
ALTER PLUGGABLE DATABASE CONTAINERS PORT RESET;
Related Topics
- Connecting to a PDB
- Creating a PDB as a Proxy PDB
- PORT Clause
Parent topic: Modifying the Listener Settings of a Referenced PDB
15.3 Modifying a PDB at the System Level
You can use the ALTER SYSTEM
statement to modify a PDB.
This section contains the following topics:
- About System-Level Modifications of a PDB
TheALTER SYSTEM
statement can dynamically alter a PDB. You can issue anALTER SYSTEM
statement when you want to change the way a PDB operates. - Modifying a PDB with ALTER SYSTEM
To modify a PDB at the system level, use theALTER SYSTEM
statement (just as for a non-CDB).
Parent topic: Administering PDBs
15.3.1 About System-Level Modifications of a PDB
ALTER SYSTEM语句可以动态更改PDB。当您希望更改PDB的操作方式时,可以发出ALTER SYSTEMstatement。
When the current container is a PDB, you can run the following ALTER SYSTEM
statements:
ALTER SYSTEM FLUSH { SHARED_POOL | BUFFER_CACHE | FLASH_CACHE }
ALTER SYSTEM { ENABLE | DISABLE } RESTRICTED SESSION
ALTER SYSTEM SET USE_STORED_OUTLINES
ALTER SYSTEM { SUSPEND | RESUME }
ALTER SYSTEM CHECKPOINT
ALTER SYSTEM CHECK DATAFILES
ALTER SYSTEM REGISTER
ALTER SYSTEM { KILL | DISCONNECT } SESSION
ALTER SYSTEM SET initialization_parameter
(for a subset of initialization parameters)
所有其他ALTER SYSTEM语句都会影响整个CDB,并且必须由根目录中的一个普通用户运行。
ALTER SYSTEM SET initialization_parameter语句只能修改PDBs的一些初始化参数。可以为根设置所有初始化参数。对于没有为PDB显式设置的任何初始化参数,PDB从根继承参数值。
当ispdb_modiable列对于V$SYSTEM_PARAMETER视图中的参数为真时,可以修改PDB的初始化参数。以下查询列出了所有可为PDB修改的初始化参数:
SELECT NAME
FROM V$SYSTEM_PARAMETER
WHERE ISPDB_MODIFIABLE='TRUE'
ORDER BY NAME;
When the current container is a PDB, run the ALTER SYSTEM SETinitialization_parameter
statement to modify the PDB. The statement does not affect the root or other PDBs. The following table describes the behavior of the SCOPE
clause when you use a server parameter file (SPFILE) and run the ALTER SYSTEM SET
statement on a PDB.
SCOPE Setting | Behavior |
---|---|
|
The initialization parameter setting is changed in memory and takes effect immediately in the PDB. The new setting affects only the PDB. The setting reverts to the value set in the root in the any of the following cases:
|
|
The initialization parameter setting is changed for the PDB and stored persistently. The new setting takes effect in any of the following cases:
In these cases, the new setting affects only the PDB. |
|
The initialization parameter setting is changed in memory, and it is changed for the PDB and stored persistently. The new setting takes effect immediately in the PDB and persists after the PDB is closed and re-opened or the CDB is shut down and re-opened. The new setting affects only the PDB. |
当从CDB中拔出PDB时,使用SCOPE=BOTH或SCOPE=SPFILE为PDB指定的初始化参数的值被添加到PDB的XML元数据文件中。当PDB被插入到CDB时,将恢复这些值
Note:
A text initialization parameter file (PFILE) cannot contain PDB-specific parameter values.
See Also:
"Unplugging a PDB from a CDB"
"About the Current Container"
"Modifying a CDB with ALTER SYSTEM"
Oracle Database SQL Language Reference
Parent topic: Modifying a PDB at the System Level
15.3.2 Modifying a PDB with ALTER SYSTEM
To modify a PDB at the system level, use the ALTER SYSTEM
statement (just as for a non-CDB).
CREATE SESSION
ALTER SYSTEM
To use ALTER SYSTEM to modify a PDB:
In SQL*Plus, ensure that the current container is a PDB.
See "Connecting to a PDB".
Run the
ALTER SYSTEM
statement.
Example 15-12 Enable Restricted Sessions in a PDB
To restrict sessions in a PDB, issue the following statement:
ALTER SYSTEM ENABLE RESTRICTED SESSION;
Example 15-13 Changing the Statistics Gathering Level for the PDB
This ALTER SYSTEM
statement sets the STATISTICS_LEVEL
initialization parameter to ALL
for the current PDB:
ALTER SYSTEM SET STATISTICS_LEVEL = ALL SCOPE = MEMORY;
See Also:
"Modifying a CDB with ALTER SYSTEM"
Oracle Database SQL Language Reference
Parent topic: Modifying a PDB at the System Level
15.4 Modifying a PDB at the Database Level
You can modify a PDB using the ALTER PLUGGABLE DATABASE
statement.
This section contains the following topics:
- About Database-Level Modifications of a PDB
TheALTER PLUGGABLE DATABASE
for a PDB is analogous to theALTER DATABASE
for a non-CDB. - Modifying a PDB with the ALTER PLUGGABLE DATABASE Statement
To modify the attributes of a single PDB, use theALTER PLUGGABLE DATABASE
statement. - Changing the Global Database Name of a PDB
You can change the global database name of a PDB with theALTER PLUGGABLE DATABASE RENAME GLOBAL_NAME TO
statement. - Managing Refreshable Clone PDBs
A refreshable clone PDB is a read-only clone that can periodically synchronize with its source PDB.
Parent topic: Administering PDBs
15.4.1 About Database-Level Modifications of a PDB
The ALTER PLUGGABLE DATABASE
for a PDB is analogous to the ALTER DATABASE
for a non-CDB.
This section contains the following topics:
- Storage Clauses
UseALTER PLUGGABLE DATABASE
to configure storage at the PDB level. - Logging and Recovery Clauses
UseALTER PLUGGABLE DATABASE
to set logging and recovery and recovery modes at the PDB level. - Miscellaneous Clauses
You can useALTER PLUGGABLE DATABASE
to modify the open mode, global name, time zone, and default edition.
Parent topic: Modifying a PDB at the Database Level
15.4.1.1 Storage Clauses
Use ALTER PLUGGABLE DATABASE
to configure storage at the PDB level.
以下是ALTER PLUGGABLE DATABASE修改PDB存储的条款:
database_file_clauses
These clauses work the same as they would in an
ALTER DATABASE
statement, but the statement applies to the current PDB.DEFAULT TABLESPACE
clauseFor users created while the current container is a PDB, this clause specifies the default tablespace for the user if the default tablespace is not specified in the
CREATE USER
statement.DEFAULT TEMPORARY TABLESPACE
clauseFor users created while the current container is a PDB, this clause specifies the default temporary tablespace for the user if the default temporary tablespace is not specified in the
CREATE USER
statement.SET DEFAULT { BIGFILE | SMALLFILE } TABLESPACE
clauseThis clause changes the default type of subsequently created tablespaces in the PDB to either bigfile or smallfile. This clause works the same as it would in an
ALTER DATABASE
statement, but it applies to the current PDB.pdb_storage_clause
This clause sets a limit on the amount of storage used by all tablespaces that belong to a PDB. This limit applies to the total size of all data files and temp files comprising tablespaces that belong to the PDB.
This clause can also set a limit on the amount of storage that can be used by unified audit OS spillover (.bin format) files in the PDB. If the limit is reached, then no additional storage is available for these files.
This clause can also set a limit on the amount of storage in a shared temporary tablespace that can be used by sessions connected to the PDB. If the limit is reached, then no additional storage in the shared temporary tablespace is available to sessions connected to the PDB.
Parent topic: About Database-Level Modifications of a PDB
15.4.1.2 Logging and Recovery Clauses
使用ALTER PLUGGABLE数据库在PDB级别设置日志记录和恢复以及恢复模式。
logging_clause
Note:
This clause is available starting with Oracle Database 12c Release 1 (12.1.0.2).
This clause specifies the logging attribute of the PDB. The logging attribute controls whether certain DML operations are logged in the redo log file (LOGGING
) or not (NOLOGGING
).
You can use this clause to specify one of the following attributes:
LOGGING
indicates that any future tablespaces created within the PDB will be created with theLOGGING
attribute by default. You can override this default logging attribute by specifyingNOLOGGING
at the schema object level, in aCREATE TABLE
statement for example.NOLOGGING
indicates that any future tablespaces created within the PDB will be created with theNOLOGGING
attribute by default. You can override this default logging attribute by specifyingLOGGING
at the schema object level, in aCREATE TABLE
statement for example.
The specified attribute is used to establish the logging attribute of tablespaces created within the PDB if the logging_clause is not specified in the CREATE TABLESPACE
statement.
The DBA_PDBS
view shows the current logging attribute for a PDB.
Note:
The PDB must be open in restricted mode to use this clause.
pdb_force_logging_clause
Note:
这个子句可以从Oracle数据库12c版本1(12.1.0.2)开始使用。
此子句将PDB置于强制日志记录或强制nologging模式中,或将PDB置于强制日志记录或强制nologging模式中。
You can use this clause to specify one of the following attributes:
ENABLE FORCE LOGGING
places the PDB in force logging mode, which causes all changes in the PDB, except changes in temporary tablespaces and temporary segments, to be logged. Force logging mode cannot be overridden at the schema object level.PDB-level force logging mode takes precedence over and is independent of any
NOLOGGING
orFORCE LOGGING
settings you specify for individual tablespaces in the PDB and anyNOLOGGING
settings you specify for individual database objects in the PDB.ENABLE FORCE LOGGING
cannot be specified if a PDB is in force nologging mode.DISABLE FORCE NOLOGGING
must be specified first.DISABLE FORCE LOGGING
takes a PDB which is currently in force logging mode out of that mode. If the PDB is not in force logging mode currently, then specifyingDISABLE FORCE LOGGING
results in an error.ENABLE FORCE NOLOGGING
places the PDB in force nologging mode, which causes no changes in the PDB to be logged. Force nologging mode cannot be overridden at the schema object level.CDB-wide force logging mode supersedes PDB-level force nologging mode. PDB-level force nologging mode takes precedence over and is independent of any
LOGGING
orFORCE LOGGING
settings you specify for individual tablespaces in the PDB and anyLOGGING
settings you specify for individual database objects in the PDB.ENABLE FORCE NOLOGGING
cannot be specified if a PDB is in force logging mode.DISABLE FORCE LOGGING
must be specified first.DISABLE FORCE NOLOGGING
takes a PDB that is currently in force nologging mode out of that mode. If the PDB is not in force nologging mode currently, then specifyingDISABLE FORCE NOLOGGING
results in an error.
The DBA_PDBS
view shows whether a PDB is in force logging or force nologging mode.
Note:
The PDB must be open in restricted mode to use this clause.
pdb_recovery_clause
Note:
This clause is available starting with Oracle Database 12c Release 1 (12.1.0.2).
ALTER PLUGGABLE DATABASE DISABLE RECOVERY
takes the data files that belong to the PDB offline and disables recovery of the PDB. The PDB data files are not part of any recovery session until it is enabled again. Any new data files created while recovery is disabled are created as unnamed files for the PDB.
ALTER PLUGGABLE DATABASE ENABLE RECOVERY
brings the data files that belong to the PDB online and marks the PDB for active recovery. Recovery sessions include these files.
Check the recovery status of a PDB by querying the RECOVERY_STATUS
column in the V$PDBS
view.
See Also:
Oracle Data Guard Concepts and Administration for more information about the pdb_recovery_clause.
Oracle Database Administrator’s Guide for information about controlling the writing of redo records
Oracle Database SQL Language Reference for more information about the logging attribute
Parent topic: About Database-Level Modifications of a PDB
15.4.1.3
- 其他条款
您可以使用ALTER PLUGGABLE数据库修改打开模式、全局名称、时区和默认版本。
当当前容器是PDB时,使用带有以下任何子句的ALTER PLUGGABLE数据库语句修改PDB:
pdb_change_state_clause
This clause changes the open mode of the current PDB.
If you specify the optional
RESTRICTED
keyword, then the PDB is accessible only to users with theRESTRICTED SESSION
privilege in the PDB.Specifying
FORCE
in this clause changes semantics of theALTER PLUGGABLE DATABASE
statement so that, in addition to opening a PDB that is currently closed, it can be used to change the open mode of a PDB that is already open.RENAME GLOBAL_NAME
clauseThis clause changes the unique global database name for the PDB. The new global database name must be different from that of any container in the CDB. When you change the global database name of a PDB, the PDB name is changed to the name before the first period in the global database name.
You must change the
PDB
property of database services used to connect to the PDB when you change the global database name.set_time_zone_clause
This clause works the same as it would in an
ALTER DATABASE
statement, but it applies to the current PDB.DEFAULT EDITION
clauseThis clause works the same as it would in an
ALTER DATABASE
statement, but it applies to the current PDB. Each PDB can use edition-based redefinition, and editions in one PDB do not affect editions in other PDBs. In a multitenant environment in which each PDB has its own application, you can use edition-based redefinition independently for each distinct application.
See Also:
"Managing Services for PDBs"
"Modifying the Open Mode of PDBs with ALTER PLUGGABLE DATABASE"
Parent topic: About Database-Level Modifications of a PDB
15.4.2 Modifying a PDB with the ALTER PLUGGABLE DATABASE Statement
要将PDB的打开模式从挂载改为打开或从打开改为挂载,当前用户必须具有SYSDBA、SYSOPER、SYSBACKUP或SYSDG管理特权。特权必须在PDB中通常授予或本地授予。用户必须在连接时使用作为sys_privilege_name的特权。
对于使用ALTER PLUGGABLE数据库语句执行的所有其他操作,当前用户必须具有ALTER数据库系统特权,该特权必须在PDB中通常授予或本地授予。
要关闭PDB,必须打开PDB。
Note:
本节不涉及使用ALTER PLUGGABLE数据库语句更改PDB的全局数据库名称。
要修改PDB:
In SQL*Plus, ensure that the current container is a PDB.
Run an
ALTER PLUGGABLE DATABASE
statement.
Example 15-14 Changing the Open Mode of a PDB
This ALTER PLUGGABLE DATABASE
statement changes the open mode of the current PDB to mounted.
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
The following statement changes the open mode of the current PDB to open read-only.
ALTER PLUGGABLE DATABASE OPEN READ ONLY;
A PDB must be in mounted mode to change its open mode to read-only or read/write unless you specify the FORCE
keyword.
The following statement changes the open mode of the current PDB from mounted or open read-only to open read/write.
ALTER PLUGGABLE DATABASE OPEN FORCE;
The following statement changes the open mode of the current PDB from mounted to migrate.
ALTER PLUGGABLE DATABASE OPEN UPGRADE;
Example 15-15 Bringing a Data File Online for a PDB
This ALTER PLUGGABLE DATABASE
statement uses a database_file_clause to bring the /u03/oracle/pdb1_01.dbf
data file online.
ALTER PLUGGABLE DATABASE DATAFILE '/u03/oracle/pdb1_01.dbf' ONLINE;
Example 15-16 Changing the Default Tablespaces for a PDB
This ALTER PLUGGABLE DATABASE
statement uses a DEFAULT TABLESPACE
clause to set the default permanent tablespace to pdb1_tbs
for the PDB.
ALTER PLUGGABLE DATABASE DEFAULT TABLESPACE pdb1_tbs;
This ALTER PLUGGABLE DATABASE
statement uses a DEFAULT TEMPORARY TABLESPACE
clause to set the default temporary tablespace to pdb1_temp
for the PDB.
ALTER PLUGGABLE DATABASE DEFAULT TEMPORARY TABLESPACE pdb1_temp;
The tablespace or tablespace group specified in the ALTER PLUGGABLE DATABASE
statement must exist in the PDB. Users whose current container is a PDB that are not explicitly assigned a default tablespace or default temporary tablespace use the default tablespace or default temporary tablespace for the PDB.
Example 15-17 Changing the Default Tablespace Type for a PDB
This ALTER DATABASE
statement uses a SET DEFAULT TABLESPACE
clause to change the default tablespace type to bigfile for the PDB.
ALTER PLUGGABLE DATABASE SET DEFAULT BIGFILE TABLESPACE;
Example 15-18 Setting Storage Limits for a PDB
This statement sets the storage limit for all tablespaces that belong to a PDB to two gigabytes.
ALTER PLUGGABLE DATABASE STORAGE(MAXSIZE 2G);
This statement specifies that there is no storage limit for the tablespaces that belong to the PDB.
ALTER PLUGGABLE DATABASE STORAGE(MAXSIZE UNLIMITED);
This statement specifies that there is no storage limit for the tablespaces that belong to the PDB and that there is no storage limit for the shared temporary tablespace that can be used by sessions connected to the PDB.
ALTER PLUGGABLE DATABASE STORAGE UNLIMITED;
Example 15-19 Setting the Logging Attribute of a PDB
With the PDB open in restricted mode, this statement specifies the NOLOGGING
attribute for the PDB:
ALTER PLUGGABLE DATABASE NOLOGGING;
Example 15-20 Setting the Force Logging Mode of a PDB
This statement enables force logging mode for the PDB:
ALTER PLUGGABLE DATABASE ENABLE FORCE LOGGING;
Example 15-21 Setting the Default Edition for a PDB
This example sets the default edition for the current PDB to PDB1E3
.
ALTER PLUGGABLE DATABASE DEFAULT EDITION = PDB1E3;
See Also:
"About Database-Level Modifications of a PDB" for information about the clauses that modify the attributes of a single PDB
"Changing the Global Database Name of a PDB"
Oracle Database SQL Language Reference for more information about the
ALTER PLUGGABLE DATABASE
statementOracle Database Development Guide for a complete discussion of edition-based redefinition
Parent topic: Modifying a PDB at the Database Level
The following prerequisites must be met:
当前用户必须具有ALTER数据库系统特权,并且该特权必须在PDB中通常授予或本地授予。
对于Oracle Real Application Clusters (Oracle RAC)数据库,PDB必须只在当前实例上打开。PDB必须对所有其他实例关闭。
被修改的PDB必须以读/写模式在当前实例上打开,并且指定了受限制的模式,以便只有PDB中具有受限制的SESSIONprivilege的用户才能访问它。
To change the global database name of a PDB:
In SQL*Plus, ensure that the current container is a PDB.
Run an
ALTER PLUGGABLE DATABASE RENAME GLOBAL_NAME TO
statement.The following example changes the global database name of the PDB to
salespdb.example.com
:ALTER PLUGGABLE DATABASE RENAME GLOBAL_NAME TO salespdb.example.com;
Close the PDB.
Open the PDB in read/write mode.
当您更改PDB的全局数据库名称时,PDB名称将更改为新全局名称的第一部分,即第一个句点之前的部分。此外,Oracle数据库自动更改PDB的默认数据库服务的名称。Oracle数据库还将PDB中所有数据库服务的PDBproperty更改为PDB的新全局名称。要将新的PDB服务名称集成到CDB中,必须关闭PDB并以Oracle数据库的读/写模式打开它。
必须正确配置Oracle Net服务,以便客户机访问数据库服务。由于PDB名称的更改,您可能需要更改Oracle Net Services配置。
See Also:
"Connecting to a PDB"
"Managing Services for PDBs" for information about PDBs and database services
Parent topic: Modifying a PDB at the Database Level
15.4.4 管理可更新的克隆PDBs
可刷新克隆PDB是一个只读克隆,它可以定期与其源PDB同步。
This section contains the following topics:
- Refreshing a PDB
You can refresh a PDB that was created as a refreshable clone. - Switching Over a Refreshable Clone PDB
You can switch the roles of a source PDB and its refreshable clone PDB.
Parent topic: Modifying a PDB at the Database Level
15.4.4.1刷新PDB
您可以刷新作为可刷新克隆创建的PDB。
当手动刷新PDB时,自上次刷新以来对源PDB所做的更改将传播到正在刷新的PDB。您可以手动刷新为自动刷新配置的PDB。
Prerequisites
要刷新PDB,必须将PDB创建为克隆,并包含refresh MODE MANUAL或refresh MODE EVERY minutes子句。
- In SQL*Plus, ensure that the current container is the PDB you want to refresh.
- If the PDB is not closed, then close the PDB. For example, issue the following SQL statement:
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
- Issue the following SQL statement:
ALTER PLUGGABLE DATABASE REFRESH;
Related Topics
- About Refreshable Clone PDBs
Parent topic: Managing Refreshable Clone PDBs
15.4.4.2 切换到可刷新的克隆PDB
您可以切换源PDB及其可刷新克隆PDB的角色。
下面的语句执行切换:
ALTER PLUGGABLE DATABASE refresh_mode FROM clonepdb@dblink SWITCHOVER;
您不能为refresh_mode指定刷新模式NONE。FROM子句中指定的数据库链接必须指向克隆PDB所在的CDB的根。
切换完成后,源PDB成为可刷新的克隆PDB,只能在只读模式下打开。
Prerequisites
You must meet the following prerequisites:
You must be connected to the source PDB when you issue
ALTER PLUGGABLE DATABASE ... SWITCHOVER
.If the source PDB and clone PDB are in separate CDBs, then the user specified in the database link must have the same name and password in the source PDB and clone PDB.
To switch the roles of the source and clone PDBs:
In SQL*Plus or SQL Developer, log in to the source PDB.
Execute the
ALTER PLUGGABLE DATABASE refresh_mode FROMclonepdb@dblink SWITCHOVER
statement.After the statement completes, the currently connected PDB is now the refreshable clone PDB.
Optionally, refresh the clone PDB:
ALTER PLUGGABLE DATABASE REFRESH;
Example 15-22 Switching Over a Refreshable Clone PDB
本例假设您的数据中心包含名为cdb1和cdb2的CDBs。名为cdb1_pdb1的PDB驻留在cdb1中。您希望在cdb2中创建这个PDB的可刷新克隆,并将其命名为cdb1_pdb1_ref。您的目标是切换到cdb1_pdb1_ref,以便它成为源PDB, cdb1_pdb1成为克隆PDB。
In SQL*Plus, connect to
cdb1
as a user with administrator privileges, and then ensure sure thatcdb1_pdb1
is open in read/write mode (sample output included):CONNECT SYS@cdb1 AS SYSDBA Enter password: *******ALTER PLUGGABLE DATABASE ALL CLOSE; ALTER PLUGGABLE DATABASE cdb1_pdb1 OPEN READ WRITE; SHOW PDBS;CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ----------2 PDB$SEED READ ONLY NO3 CDB1_PDB1 READ WRITE NO
Create a common user named
c##u1
(replace pwd with a user-specified password):DROP USER c##u1 CASCADE; CREATE USER c##u1 IDENTIFIED BY pwd; GRANT CREATE SESSION, RESOURCE, CREATE ANY TABLE, UNLIMITED TABLESPACE TO c##u1 CONTAINER=ALL; GRANT CREATE PLUGGABLE DATABASE TO c##u1 CONTAINER=ALL; GRANT SYSOPER TO c##u1 CONTAINER=ALL;
Set the container to
cdb1_pdb1
, and then create a tablet1
to use for testing (sample output included):ALTER SESSION SET CONTAINER = cdb1_pdb1; CREATE TABLE t1(n1 NUMBER); INSERT INTO t1 VALUES(1); COMMIT; SELECT * FROM t1;N1 ----------1
Connect to
cdb2
as a user with administrator privileges, and then create the common user namedc##u1
(replace pwd with a user-specified password):CONNECT SYS@cdb2 AS SYSDBA Enter password: *******DROP USER c##u1 CASCADE; CREATE USER c##u1 IDENTIFIED BY pwd; GRANT CREATE SESSION, RESOURCE, CREATE ANY TABLE, UNLIMITED TABLESPACE TO c##u1 CONTAINER=ALL; GRANT CREATE PLUGGABLE DATABASE TO c##u1 CONTAINER=ALL; GRANT SYSOPER TO c##u1 CONTAINER=ALL;
Now
cdb1
andcdb2
both have a common user with the same name (c##u1
) and password.Create a database link to
cdb1
.The following command specifies user
c##u1
, password pwd, and service namecdb1
:CREATE DATABASE LINK cdb1_datalink CONNECT TO c##u1 IDENTIFIED BY pwd USING 'cdb1';
Create the manually refreshable PDB named
cdb1_pdb1_ref
.The following statement specifies the database link
cdb1_datalink
and the file destination/dsk1/df
:CREATE PLUGGABLE DATABASE cdb1_pdb1_ref FROM cdb1_pdb1@cdb1_datalink CREATE_FILE_DEST='/dsk1/df' REFRESH MODE MANUAL;
Refresh
cdb1_pdb1_ref
:ALTER SESSION SET CONTAINER = cdb1_pdb1_ref; ALTER PLUGGABLE DATABASE REFRESH;
Query
t1
to check that the refreshable clone PDB contains the correct contents (sample output included):ALTER PLUGGABLE DATABASE OPEN READ ONLY; SELECT * FROM t1;N1 ----------1
Connect to
cdb1
as a user with administrator privileges, and then create a database link tocdb2
:CONNECT SYS@cdb1 AS SYSDBA Enter password: *******CREATE DATABASE LINK cdb2_datalink CONNECT TO c##u1 IDENTIFIED BY pwd USING 'cdb2';
The preceding statement specifies user
c##u1
, password pwd, and service namecdb2
.Set the container to
cdb1_pdb1
, and then switch over so thatcdb1_pdb1_ref
is the primary PDB and the current PDB is the clone:ALTER SESSION SET CONTAINER = cdb1_pdb1; ALTER PLUGGABLE DATABASE REFRESH MODE MANUAL FROM cdb1_pdb1_ref@cdb2_datalink SWITCHOVER;
Query
t1
to check that the current PDB, which is now the refreshable clone PDB, contains the correct contents (sample output included):ALTER PLUGGABLE DATABASE OPEN READ ONLY; SELECT * FROM t1;N1 ----------1
Connect to
cdb2
as a user with administrator privileges, set the container to the new source PDBcdb1_pdb1_ref
, and then insert a new row into tablet1
(sample output included):CONNECT SYS@cdb2 AS SYSDBA Enter password: *******ALTER SESSION SET CONTAINER = cdb1_pdb1_ref; SELECT * FROM t1;N1 ----------1INSERT INTO t1 VALUES(2); COMMIT; SELECT * FROM t1;N1 ----------12
Connect to
cdb1
as a user with administrator privileges, set the container tocdb1_pdb1
(which is the new clone), refresh it, and then queryt1
:CONNECT SYS@cdb1 AS SYSDBA Enter password: *******ALTER SESSION SET CONTAINER = cdb1_pdb1; ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE; ALTER PLUGGABLE DATABASE REFRESH; ALTER PLUGGABLE DATABASE OPEN READ ONLY; SELECT * FROM t1;N1 ----------12
The preceding output shows that the clone
cdb1_pdb1
was refreshed from the sourcecdb1_pdb1_ref
.
Parent topic: Managing Refreshable Clone PDBs
15.5 Starting Up and Shutting Down a PDB
This section contains the following topics:
- Starting Up a PDB Using the STARTUP Command
When the current container is a PDB, the SQL*PlusSTARTUP
command opens the PDB. - Shutting Down a PDB Using the SHUTDOWN Command
When the current container is a PDB, the SQL*PlusSHUTDOWN
command closes the PDB.
Parent topic: Administering PDBs
15.5.1 Starting Up a PDB Using the STARTUP Command
When the current container is a PDB, the SQL*Plus STARTUP
command opens the PDB.
Use the following options of the STARTUP
command to open a PDB:
FORCE
Closes an open PDB before re-opening it in read/write mode. When this option is specified, no other options are allowed.
RESTRICT
Enables only users with the
RESTRICTED
SESSION
system privilege in the PDB to access the PDB.If neither
OPEN READ WRITE
norOPEN READ ONLY
is specified andRESTRICT
is specified, then the PDB is opened in read-only mode when the CDB to which it belongs is a physical standby database. Otherwise, the PDB is opened in read/write mode.OPEN open_pdb_options
Opens the PDB in either read/write mode or read-only mode. Specify
OPEN READ WRITE
orOPEN READ ONLY
. WhenRESTRICT
is not specified,READ WRITE
is always the default.
To issue the STARTUP
command when the current container is a PDB, the following prerequisites must be met:
The current user must have
SYSDBA
,SYSOPER
,SYSBACKUP
, orSYSDG
administrative privilege, and the privilege must be either commonly granted or locally granted in the PDB. The user must exercise the privilege usingAS SYSDBA
,AS SYSOPER
,AS SYSBACKUP
, orAS SYSDG
, respectively, at connect time.Excluding the use of the
FORCE
option, the PDB must be in mounted mode to open it.To place a PDB in mounted mode, the PDB must be in open read-only or open read/write mode.
To modify a PDB with the STARTUP command:
In SQL*Plus, ensure that the current container is a PDB.
Run the
STARTUP
command.
Example 15-23 Opening a PDB in Read/Write Mode with the STARTUP Command
STARTUP OPEN
Example 15-24 Opening a PDB in Read-Only Mode with the STARTUP Command
STARTUP OPEN READ ONLY
Example 15-25 Opening a PDB in Read-Only Restricted Mode with the STARTUP Command
STARTUP RESTRICT OPEN READ ONLY
Example 15-26 Opening a PDB in Read/Write Mode with the STARTUP Command and the FORCE Option
This example assumes that the PDB is currently open. The FORCE
option closes the PDB and then opens it in the read/write mode.
STARTUP FORCE
See Also:
"About the Current Container"
- "Connecting to a PDB".
Oracle Database Administrator’s Guide for information about starting up a database
SQL*Plus User's Guide and Reference
Parent topic: Starting Up and Shutting Down a PDB
15.5.2 Shutting Down a PDB Using the SHUTDOWN Command
当当前容器是PDB时,SQL*Plus SHUTDOWN命令关闭PDB。
在PDB上成功发出SHUTDOWN命令后,它就处于挂载模式。
The following SHUTDOWN
modes are possible:
When you specify
SHUTDOWN
only, then the PDB is shut down with the normal mode.When you specify
SHUTDOWN IMMEDIATE
, the PDB is shut down with the immediate mode.When you specify
SHUTDOWN ABORT
, the PDB is forcefully closed.For a single-instance CDB, PDB media recovery is required when you specify
SHUTDOWN ABORT
. For an Oracle Real Application Clusters (Oracle RAC) CDB, PDB media recovery is required if theSHUTDOWN ABORT
command closes the last open instance.
Prerequisites
To issue the SHUTDOWN
command when the current container is a PDB, the following prerequisites must be met:
The current user must have
SYSDBA
,SYSOPER
,SYSBACKUP
, orSYSDG
administrative privilege, and the privilege must be either commonly granted or locally granted in the PDB. The user must exercise the privilege usingAS SYSDBA
,AS SYSOPER
,AS SYSBACKUP
, orAS SYSDG
, respectively, at connect time.To close a PDB, the PDB must be open.
To modify a PDB with the SHUTDOWN
command:
In SQL*Plus, ensure that the current container is a PDB.
Run the
SHUTDOWN
command.
Note:
When the current container is a PDB, the
SHUTDOWN
command only closes the PDB, not the CDB instance.There is no
SHUTDOWN
command for a PDB that is equivalent toSHUTDOWN
TRANSACTIONAL
for a non-CDB.
Example 15-27 Closing a PDB with the SHUTDOWN IMMEDIATE Command
SHUTDOWN IMMEDIATE
See Also:
"About the Current Container"
"Connecting to a PDB"
"Modifying the Open Mode of PDBs with ALTER PLUGGABLE DATABASE"
Oracle Database Administrator’s Guide for more information about shutdown modes
SQL*Plus User's Guide and Reference
Parent topic: Starting Up and Shutting Down a PDB
【跟我学oracle18c】第二十五天:Multitenant :15 管理PDBs相关推荐
- jpa日志 logback_SpringBoot | 第二十五章:日志管理之自定义Appender
前言 前面两章节我们介绍了一些日志框架的常见配置及使用实践.一般上,在开发过程中,像log4j2.logback日志框架都提供了很多Appender,基本上可以满足大部分的业务需求了.但在一些特殊需求 ...
- 并查集路径压缩_第二十五天:并查集
今天是释然发题解的第二十五天,以后会经常和大家分享学习路上的心得,希望和大家一起进步,一起享受coding的乐趣 本文约1400字,预计阅读5分钟 昨天我们学习了动态规划之线性规划,忘记的小伙伴们可以 ...
- 史记翻译-汉初三杰-张良-留侯世家第二十五
留侯世家第二十五 徐世英 译注 [说明]这是一篇关于张良的传记.文中围绕张良一生的经历,描述了他在复杂的政治斗争和尖锐的军事斗争中的超群才干,以及他在功成名就之后不争权求利的出世思想和行为,生动地刻画 ...
- android 猜歌游戏报告,Android第二十五期 - 猜歌小游戏
周五开会时,有人提出在团队中采用结对开发的Agile实践. 当然团队里有人说,如果让新手与水平高的人结对,基本上就是知识的单向传递了,对于新手来说的确是个不错的学... //#include ...
- 计算机三级网络技术题库第15套,计算机等级考试理论试题第二十五套
1.十进制数 141 转换成无符号二进制数是______. A.10011101 B.10001011 C.10001100 D.10001101 2.当前计算机感染病毒的可能途径之一是______. ...
- 第二十五章补充内容 3 assert()宏
//第二十五章补充内容 3 assert()宏 //有的编译器还提供了assert()宏,这个宏在许多书中被翻译为断言,它的作用是当assert()的参数为真时,返回真,假如参数值为假,那么它将执行某 ...
- Python编程基础:第二十五节 args参数*args
第二十五节 args参数*args 前言 实践 前言 我们目前学习到的函数的参数个数都是固定的,那么我们是否可以指定任意多个参数呢?其实是可以的,这里就用到了args参数,它可以将用户指定的任意多个参 ...
- 25 linux ndk 头文件_正点原子Linux第二十五章RTC实时时钟实验
1)资料下载:点击资料即可下载 2)对正点原子Linux感兴趣的同学可以加群讨论:935446741 3)关注正点原子公众号,获取最新资料更新 第二十五章RTC实时时钟实验 实时时钟是很常用的一个外设 ...
- 鸟哥的Linux私房菜(基础篇)- 第二十五章、 Linux 备份策略
第二十五章. Linux备份策略 最近升级日期:2009/09/18 万一不幸你的 Linux 被黑客入侵了.或是你的 Linux 系统由於硬件关系 (不论是天灾还是人祸) 而挂掉了!这个时候,请问如 ...
- 第二十五章补充内容 5 不能为0的变量
// 第二十五章补充内容 5 不能为0的变量 /*#define DEBUG #include <iostream> #include <string> using names ...
最新文章
- who,cut,diff,which,whereis,locate,updatedb 命令的使用
- count/distinct/group by的用法总结
- 张迈机器人_财会类专业建设改革千人高峰论坛圆满召开!
- JavaSE 学习参考:变量(1)
- boss直聘用什么语言开发_我不在乎开发人员使用什么工具。 我根据基本原则聘用。...
- C#操作数据库,将其查查出来的记录条数显示在winform窗体中的方法之一
- 家用千兆路由器哪款好?家用千兆无线路由器推荐TOP10!
- office文档转换为html,OFFICE 文档转换为html在线预览
- ABC Amber CHM Converter:CHM转换PDF
- Crazy Rows
- 奥奇手游怎么显示部分服务器,奥奇传说手游区服互通吗
- SQL SERVER学习记录
- 70行脚本实现促销信息微信通知
- w13scan 扫描器的安装及应用
- ue4 unreal NDisplay插件 简易使用 三折幕 详细...
- 《python 程序设计》读书笔记
- rtx2060相当于gtx多少 rtx2060属于什么档次的显卡 rtx2060显卡怎么样
- 倍福端子用直径2.4mm的螺丝刀
- MacDroid for Mac(安卓手机文件传输助手)
- 解构「私域流量」(一)|底层思维
热门文章
- biee for mysql_BIEE11GRpd合并
- java面试题目及答案汇总 侵删
- 关闭 VS的实时调试器
- web flag.php,CTF-WEB:PHP 变量
- 数字化母婴店,母婴智慧会员管理小程序
- java comparator相等_Java Comparator thenComparingDouble()用法及代码示例
- 【Java 8 新特性】Java Comparator.comparing | 提取对象属性,按照指定规则排序
- 11.EM算法、HMM模型
- 第6章 使用过滤器和监听器
- mysql在xml中jdbctype_MyBatis中的JdbcType映射介绍