重建序列
select 'create sequence '|| sequence_owner ||'.'|| sequence_name ||
' minvalue '|| min_value ||
' maxvalue '|| max_value ||
' start with '|| last_number ||
' increment by '|| increment_by ||
(case when cache_size=0 then ' nocache' else ' cache '|| cache_size end) ||';'
from dba_sequences where sequence_owner in('USERNAME');
怎么自动生成目标表空间的创建语句?
SELECT DBMS_METADATA.GET_DDL('TABLESPACE', TS.tablespace_name) FROM DBA_TABLESPACES TS;
怎么生成指定表的创建语句?
set pages 0;
set long 1000000;
select dbms_metadata.get_ddl('USERNAME') from dual;
生成权限
set echo on
set feedback off
set heading off
set verify off
filset trimspool off
set pagesize 2800
set linesize 100
col owner for a20
col object_name for a40
define fil= 'function.txt'
prompt *** Spooling to &fil
spool &fil
select 'grant '||tt.granted_role||' to '||tt.grantee||';' as SQL_text
from dba_role_privs tt where tt.grantee=(upper('&&user_name'))
union all
select 'grant '||tt.privilege||' to '||tt.grantee||';'
from dba_sys_privs tt where tt.grantee=(upper('&&user_name'))
union all
select 'grant '||tt.privilege||' on '||owner||'.'||table_name||' to '||tt.grantee||';'
from dba_tab_privs tt where tt.grantee=(upper('&&user_name'))
select 'create sequence '|| sequence_owner ||'.'|| sequence_name ||
' minvalue '|| min_value ||
' maxvalue '|| max_value ||
' start with '|| last_number ||
' increment by '|| increment_by ||
(case when cache_size=0 then ' nocache' else ' cache '|| cache_size end) ||';'
from dba_sequences where sequence_owner in('USERNAME');
怎么自动生成目标表空间的创建语句?
SELECT DBMS_METADATA.GET_DDL('TABLESPACE', TS.tablespace_name) FROM DBA_TABLESPACES TS;
怎么生成指定表的创建语句?
set pages 0;
set long 1000000;
select dbms_metadata.get_ddl('USERNAME') from dual;
生成权限
set echo on
set feedback off
set heading off
set verify off
filset trimspool off
set pagesize 2800
set linesize 100
col owner for a20
col object_name for a40
define fil= 'function.txt'
prompt *** Spooling to &fil
spool &fil
select 'grant '||tt.granted_role||' to '||tt.grantee||';' as SQL_text
from dba_role_privs tt where tt.grantee=(upper('&&user_name'))
union all
select 'grant '||tt.privilege||' to '||tt.grantee||';'
from dba_sys_privs tt where tt.grantee=(upper('&&user_name'))
union all
select 'grant '||tt.privilege||' on '||owner||'.'||table_name||' to '||tt.grantee||';'
from dba_tab_privs tt where tt.grantee=(upper('&&user_name'))