Oracle DBMS_METADATA 用法例子
rom:http://www.psoug.org/reference/dbms_metadata.html
General Information
Source
{ORACLE_HOME}/rdbms/admin/dbmsmeta.sql
First Available
9.0.1
几个常用过程或函数:
GET_DDL
Fetch DDL for objects
dbms_metadata.get_ddl(
object_type IN VARCHAR2,
name IN VARCHAR2,
schema IN VARCHAR2 DEFAULT NULL,
version IN VARCHAR2 DEFAULT 'COMPATIBLE',
model IN VARCHAR2 DEFAULT 'ORACLE',
transform IN VARCHAR2 DEFAULT 'DDL')
RETURN CLOB;
Table
CREATE TABLE test
PCTFREE 0
TABLESPACE uwdata AS
SELECT table_name, tablespace_name
from user_tables;
SET LONG 10000
SELECT dbms_metadata.get_ddl('TABLE', 'TEST')
from dual;
View
CREATE OR REPLACE VIEW my_tables AS
select table_name, tablespace_name
from user_tables;
SELECT dbms_metadata.get_ddl('VIEW', 'MY_TABLES')
from dual;
Function
CREATE OR REPLACE FUNCTION whoami RETURN VARCHAR2 IS
BEGIN
RETURN user;
END whoami;
/
SELECT dbms_metadata.get_ddl('FUNCTION', 'WHOAMI')
from dual;
Tablespace
SELECT dbms_metadata.get_ddl('TABLESPACE', 'UWDATA')
from dual;
GET_DEPENDENT_DDL
Fetch DDL for dependent objects (audits, object grants)
dbms_metadata.get_dependent_ddl(
object_type IN VARCHAR2,
base_object_name IN VARCHAR2,
base_object_schema IN VARCHAR2 DEFAULT NULL,
version IN VARCHAR2 DEFAULT 'COMPATIBLE',
model IN VARCHAR2 DEFAULT 'ORACLE',
transform IN VARCHAR2 DEFAULT 'DDL',
object_count IN NUMBER DEFAULT 10000)
RETURN CLOB;
GRANT select ON servers TO hr;
GRANT select ON servers TO scott;
set long 100000
SELECT dbms_metadata.get_dependent_ddl('OBJECT_GRANT','SERV
相关文档:
oracle表空间操作详解
1
2
3作者: 来源: 更新日期:2006-01-04
5
6
7建立表空间
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
在对数据库进行操作过程中我们可能会遇到这种情况,表中的数据可能重复出现,使我们对数据库的操作过程中带来很多的不便,那么怎么删除这些重复没有用的数据呢?
重复数据删除技术可以提供更大的备份容量,实现更长时间的数据保留,还能实现备份数据的持续验证,提高数据恢复服务水平,方便实现数据容灾等。 重复的数据 ......
索引组织表(IOT)有一种类B树的存储组织方法。普通的堆组织表是以一种无序的集合存储。而IOT中的数据是按主键有序的存储在B树索引结构中。与一般B树索引不同的的是,在IOT中每个叶结点即有每行的主键列值,又有那些非主键列值。
在IOT所对应的B树结构中,每个索引项包 ......
数据库的内存结构:
Memory structures are allocated to the Oracle instance when the instance is started.
The two major memory structures are known as the System Global Area(Also called the shared
Global Area)and the Program Global Area(also called the Private Global Area or the ......
How to land your dream Oracle DBA job
By Don Burleson, Contributor
14 Jan 2010
If you look at the Help Wanted ads, some Oracle DBA jobs look very appealing, with salaries that rival those of engineers and other professionals. Some have starting salaries as high as $85,000, with senior Orac ......