The procedure or function in this package checks if a database is ready to be transported to a target platform.
and if a database has external tables, directories or BFILEs. It will use dbms_output.put_line to
output the external objects and their owners.
测试:
declare
b boolean;
begin
b:= dbms_tdb.check_external;
end;
The following directories exist in the database:
SYS.交流滤波器场, SYS.交流场, SYS.EQUIPTYPE2000, SYS.EQUIPTYPE2500, SYS.电力系统部分, SYS.站前区, SYS.EQUIPTYPE1200, SYS.直流场, SYS.EQUIPTYPE1000, SYS.换流广场, SYS.EQUIPTYPE1300
The following BFILEs exist in the database:
BH.BIN$K67XgMLMQL+/frRMeJPTHQ==$0, BH.BIN$4WDotQFfRjGDfXXRX6G41Q==$0, BH.BIN$yW203FPNTx+dq9iQWCFicg==$0, BH.PROJ_MODEL_FILES, BH.BIN$ftxiy5V4RQ+uSFA4ueTBaA==$0, BH.BIN$mJ0T31ukT+Sh8aUeIXUOng==$0, BH.MODEL_FILES, BH.BIN$sE6ltgxhTbONiPATfi2GPA==$0, BH.BIN$5ACZO4eOTWiZTsMNBHXF9w==$0
DBMS_TDB的说明:
CREATE OR REPLACE PACKAGE DBMS_TDB IS
--++
-- Description: This function checks if a database is ready to be
-- transported to a target platform. If the database is not
-- ready to be transported and serveroutput is on, a detailed
-- description of the reason why the database cannot be
-- transported and possible ways to fix the problem will be
-- displayed
--
-- Inputs: target_platform - name of the target platform
--
-- Outputs: None
--
-- Returns: TRUE if the datababase is ready to be transported.
-- FALSE otherwise.
--++
SKIP_NONE constant number := 0;
SKIP_INACCESSIBLE constant number := 1;
SKIP_OFFLINE constant number := 2;
SKIP_READONLY constant number := 3;
FUNCTION check_db(
target_platform_name IN varchar2,
skip_option IN number)
RETURN boolean;
FUNCTION check_db(
target_platform_name IN varchar2)
RETURN boolean;
FUNCTION check_db
RETURN boolean;
--++
-- Description: This function checks if a database has external tables,
-- directories or BFILEs. It will use dbms_output.put_line to
-- output the external objects and their owners.
--
-- Inputs: None
--
-- Outputs: None
--
-- Returns: TRUE if the datababase has external tables, directories or
-- BFILEs. FALSE otherwise.
--++
FUNCTION check_external
RETURN boolean;
--++
-- Description: This procedure is used in transport script to throw a SQL
-- error so that the transport script can exit.
--
-- Inputs: should_exit - whether to exit from transport script
--
-- Outputs: None
--
-- EXCEPTIONS: ORA-9330
--++
PROCEDURE exit_transport_script(
should_exit IN varchar2);
END;
ocp考题:
429.Which of the following supplied functions is used to identify external tables, directories, and BFILES?
A. DBMS_TDB.CHECK_DIRECTORIES
B. DBMS_TDB.CHECK_EXTERNAL
C. DBMS_TDB.CHECK_BFILE
D. DBMS_TDB.CHECK_EXT
Answer: B
答案解析:
参考:http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_tdb.htm#ARPLS68854
The DBMS_TDB
package reports whether a database can be transported between platforms using the RMAN CONVERT DATABASE
command. The package verifies that databases on the current host platform are of the same endian format as the destination platform, and that the state of the current database does not prevent transport of the database.
Overview
In many cases, Oracle supports transporting databases between platforms which have the same endian format. However, even when the endian formats are the same, a database must undergo a conversion process to move from one platform to another. There are also preconditions required for the process of transporting a database, such as having the database to be transported open read-only.
The DBMS_TDB
package serves two purposes:
- Confirming that Oracle supports transporting a database from a given source platform to a given target platform
- Determining whether a database to be transported has been properly prepared for transport, and if not, identifying the condition that prevents database transport
The actual conversion is performed using the Recovery Manager CONVERT DATABASE
command. For a complete discussion of the requirements for transporting a database, the process of converting a database for transport across platforms, and examples of the use of the DBMS_TDB
subprograms in the conversion process, see Oracle Database Backup and Recovery User‘s Guide.
CHECK_EXTERNAL Function
This function determines whether a database has external tables, directories, or BFILEs.
Syntax
DBMS_TDB.CHECK_EXTERNAL
RETURN BOOLEAN;
Return Values
If the database has external tables, directories, or BFILEs, return TRUE
. Otherwise, return FALSE
.
Usage Notes
- If
SERVEROUTPUT
isON
, then the function will output the names of the external tables, directories, and BFILEs in the database. - The database must be open read-write.
Examples
This example illustrates the use of CHECK_EXTERNAL
with a database that has several external tables, directories, and BFILEs:
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
external BOOLEAN;
BEGIN
external := DBMS_TDB.CHECK_EXTERNAL;
END;
/
The following external tables exist in the database:
SH.SALES_TRANSACTIONS_EXT
The following directories exist in the database:
SYS.MEDIA_DIR, SYS.DATA_FILE_DIR, SYS.LOG_FILE_DIR, SYS.DATA_PUMP_DIR
The following BFILEs exist in the database:
PM.PRINT_MEDIA
PL/SQL procedure successfully completed.
dbms_tdb包解析