Home » RDBMS Server » Server Administration » take backup
take backup [message #167786] Mon, 17 April 2006 01:57 Go to next message
emadbsb
Messages: 334
Registered: May 2005
Location: egypt
Senior Member

hii all

i take backup from a database user to another database user
and i take it fine with no problems
it exports the tables and the packages i have on that user

i want to export the packages only without the tables
how can i do that if it is possible??

Re: take backup [message #167809 is a reply to message #167786] Mon, 17 April 2006 04:00 Go to previous messageGo to next message
orausern
Messages: 826
Registered: December 2005
Senior Member
I do not think it is possible..however it is possible to export empty tables(no data) by specifying rows=n.

Re: take backup [message #167862 is a reply to message #167786] Mon, 17 April 2006 09:42 Go to previous messageGo to next message
emadbsb
Messages: 334
Registered: May 2005
Location: egypt
Senior Member

is there not any way to export my packages only with no tables?
Re: take backup [message #167863 is a reply to message #167862] Mon, 17 April 2006 09:45 Go to previous messageGo to next message
orausern
Messages: 826
Registered: December 2005
Senior Member
No, there isn't.
Re: take backup [message #167865 is a reply to message #167862] Mon, 17 April 2006 09:56 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> is there not any way to export my packages only with no tables?
Easiest thing is what NiravShah has already posted.
Export / Import is designed as to be a method to transport data irrespective of the Operating System. It is never meant for moving stored procedures or whatever. If you do not want to export, then extract the Souce code for procedures using simple sql or dbms_metadata or any tool and compile it in destination.
Re: take backup [message #167871 is a reply to message #167786] Mon, 17 April 2006 10:56 Go to previous messageGo to next message
emadbsb
Messages: 334
Registered: May 2005
Location: egypt
Senior Member

thanks for help

but how can i extract the source code
assume that we have we have a package called
"in_package"

how can i extract it?

but i hope not to tell me copy the source code and paste it to my new user
coz i have a lot of packages

Re: take backup [message #167877 is a reply to message #167871] Mon, 17 April 2006 12:00 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>> but i hope not to tell me copy the source code

I said,
>> using simple sql or dbms_metadata or any tool
Which part of it asks you to copy one-by-one?

Did you even try any of those?
Or atleast search the forum?
All you need to do is, spool the output and run against destination.

scott@9i > desc emp_actions
PROCEDURE FIRE_EMPLOYEE
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 EMP_ID                         NUMBER                  IN
PROCEDURE HIRE_EMPLOYEE
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 ENAME                          VARCHAR2                IN
 JOB                            VARCHAR2                IN
 MGR                            NUMBER                  IN
 SAL                            NUMBER                  IN
 COMM                           NUMBER                  IN
 DEPTNO                         NUMBER                  IN

scott@9i > @get_package


  CREATE OR REPLACE PACKAGE "SCOTT"."EMP_ACTIONS" AS -- spec
   TYPE EmpRecTyp IS RECORD (emp_id INT, salary REAL);
   CURSOR desc_salary RETURN EmpRecTyp;
   PROCEDURE hire_employee (
      ename  VARCHAR2,
      job    VARCHAR2,
      mgr    NUMBER,
      sal    NUMBER,
      comm   NUMBER,
      deptno NUMBER);
   PROCEDURE fire_employee (emp_id NUMBER);
END emp_actions;
CREATE OR REPLACE PACKAGE BODY "SCOTT"."EMP_ACTIONS" AS -- body
   CURSOR desc_salary RETURN EmpRecTyp IS
      SELECT empno, sal FROM emp ORDER BY sal DESC;
   PROCEDURE hire_employee (
      ename  VARCHAR2,
      job    VARCHAR2,
      mgr    NUMBER,
      sal    NUMBER,
      comm   NUMBER,
      deptno NUMBER) IS
   BEGIN
      INSERT INTO emp VALUES (empno_seq.NEXTVAL, ename, job,
         mgr, SYSDATE, sal, comm, deptno);
   END hire_employee;

   PROCEDURE fire_employee (emp_id NUMBER) IS
   BEGIN
      DELETE FROM emp WHERE empno = emp_id;
   END fire_employee;
END emp_actions;

 ;


scott@9i > get get_package
  1  set long 500000
  2  set linesize 1000
  3  SET HEAD off
  4  set trimspool on
  5  set verify off
  6  column XXXX format a300
  7  SELECT DBMS_METADATA.GET_DDL ('PACKAGE',d.object_name)||';' from dba_objects D  WHERE owner ='SCOTT' and OBJECT_TYPE ='PACKAGE';
  8* set head on;
scott@9i >

Previous Topic: spfile
Next Topic: scp
Goto Forum:
  


Current Time: Sun Jul 07 15:45:05 CDT 2024