Query for taking Custom scripts(Package,function,procedure) Backup from the projects
================================================================
declare
v_text varchar2(4000);
begin
FOR rec_c1 IN
(select * from all_objects where object_name like '%XX%'AND OBJECT_TYPE in ('PACKAGE BODY','FUNCTION','PROCEDURE')--and rownum<3 br=""> )
LOOP
DBMS_OUTPUT.put_line ('*************Start---'||rec_c1.OBJECT_NAME||'---'||rec_c1.OBJECT_TYPE||'**********************************');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('create');
FOR rec_c2 IN
(select * from dba_source where name=rec_c1.Object_name)
loop
DBMS_OUTPUT.put_line(rec_c2.text);
end loop;
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('*************--------Ends--------**********************************');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line (' ');
end loop;
end;3>
Query for taking Custom scripts(Tables) Backup from the projects
====================================================
================================================================
declare
v_text varchar2(4000);
begin
FOR rec_c1 IN
(select * from all_objects where object_name like '%XX%'AND OBJECT_TYPE in ('PACKAGE BODY','FUNCTION','PROCEDURE')--and rownum<3 br=""> )
LOOP
DBMS_OUTPUT.put_line ('*************Start---'||rec_c1.OBJECT_NAME||'---'||rec_c1.OBJECT_TYPE||'**********************************');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('create');
FOR rec_c2 IN
(select * from dba_source where name=rec_c1.Object_name)
loop
DBMS_OUTPUT.put_line(rec_c2.text);
end loop;
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('*************--------Ends--------**********************************');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line (' ');
end loop;
end;3>
Query for taking Custom scripts(Tables) Backup from the projects
====================================================
declare
v_text varchar2(4000);
begin
FOR rec_c1 IN
(select * from all_objects where 1=1
--and object_name like '%XX%'
AND OBJECT_TYPE in ('TABLE')
and object_name in
('XXX_AP_INVOICE_CONV_STG'
)
)
LOOP
DBMS_OUTPUT.put_line ('/*************Start---'||rec_c1.OBJECT_NAME||'---'||rec_c1.OBJECT_TYPE||'*****************************/');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('create table '||rec_c1.OBJECT_NAME||' (');
FOR rec_c2 IN
(select * from dba_tab_columns where table_name=rec_c1.Object_name order by column_id asc)
loop
DBMS_OUTPUT.put_line(rec_c2.column_name||' '||rec_c2.data_type||'('||rec_c2.data_length||'),');
end loop;
DBMS_OUTPUT.put_line (');');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line ('/*************--------Ends--------**********************************/');
DBMS_OUTPUT.put_line (' ');
DBMS_OUTPUT.put_line (' ');
end loop;
end;
No comments:
Post a Comment