How to copy a JOB, PROGRAM, SCHEDULE definition to run it in another Oracle 11g DB? - oracle

I need to copy some Jobs, Schedules and Programs from an Oracle 11g DB to another one, but when I try to look for the SQL of the Job/Schedule/Program on SQL Developer 4.1.3, the SQL tab shows nothing on Edit mode.
When I open a table and I click on the SQL tab, the SQL for create the table is showed up. I was expecting a similar behavior for a Job/Schedule/Program.
How can I copy a JOB/PROGRAM/SCHEDULE definition to run it in another Oracle 11g DB?

The easiest way for Jobs is to use DBMS_METADATA:
select dbms_metadata.get_ddl('PROCOBJ', job_name)
from user_scheduler_jobs;
I'm not 100% sure about schedules / programs, though.

I think you can also use expdp utility and use include=PROCOBJ. All schedules are objects type PROCOBJ. The you should have all jobs which are owned by schema you are exporting. (If you want DDL you can use impdp with sqlfile= to write dump into SQL file. Or use method suggested by Frank Schmitt)
Unfortunately I think if you use this method or method suggested by Frank Schmitt I think you won't be able to get schedules owned by SYS.

Related

Creating a DDL for a baseline for flyway

I've got an oracle 11 XE database, with 3 schemas in it, that I want to create a DDL file for to make a baseline script to use with flyway.
I've tried to export just the DDL of all 3 schemas, but the resulting sql doesn't include the creation of the users, or the creation of the tablespaces. It just starts off with sql to create tables, which will not work as the users or the tablespaces don't exist.
Is there any way to do this with sql-developer or am I using the wrong tool for the job here?
I'm thinking I may need to include all the SYSTEM objects in the DDL, but no idea how importing that into a running oracle instance will work.
Any tips or hints I'd be grateful for, I'm starting to think this plan just isn't possible. :-(
Thanks
Matt
when we generate the ddl for a schema, we grab the schema objects, not the definition of the user that owns the schema, nor the tablespaces used IN the schema
you can still get those though, just open the DBA Panel -

Import and Export Data plus schema using SQLDeveloper 3.0.04

i am newbie to oracle and i like to export database from remote database and import it on local machine. eOn both machines i have oracle 10.2.
I need to know how to export/import schema and data from oracle 10.2 using SQLDeveloper 3.0.0.4.
To export from remote database, i have used export Tool-> Database Export -> export wizard.
and at the end i have got only sql file with DDL and DML statements but somewhere in file it is written
"Cannot render Table DDL for object XXX.TABLE_NAME with DBMS_METADATA attempting internal generator error.
I have ignored previously mentioned message and tried to run those DDL and DML statements but all this ended up with errors.
Is it possible that all this tied with read-only database user? More over, i dont find any table under tables but also tables under other users in SqlDeveloper.
Thanks in advance
As a test, can you select one object in the tree, and navigate to the script panel? SQLDEV also uses DBMS_METADATA to generate those scripts.
Also, as a work-around, try using DataPump to export and import your data. It will be much more efficient for moving around larger schemas.
Your note about not seeing tables under indicates your schema doesn't actually own any tables. You may be working with synonyms that allow you to query objects as if they are in your account. You could be running into a privilege issue, but your error message doesn't indicate that. Error messages often come in bunches, and the very first one is usually the most important.
If you could try using the EXPORT feature say against a very simple schema like SCOTT as a test, this should indicate whether there is a problem with your account settings or with the software.
I'm not sure with SQL Developer 3.0 but with version 3.1 you can follow this:
SQL Developer 3.1 Data Pump Wizards (expdp, impdp)

Exporting rows in Oracle

I need to export a number of rows (from different tables- ie, all the related information about an entity - for eg: a Customer) to another DB in Oracle. How do we do this? I am using a windows OS. Please help.
Thank you all,
Pradeep
While connected to database 1 you could also create a database link to database 2 (if you have rights to do so - there were no assumptions on this) and insert to your tables by selecting from your link e.g. like this
CREATE DATABASE LINK foo
CONNECT TO <user> IDENTIFIED BY <password>
USING '<connect string>';
select * from table1#foo;
Further information:
A database link is a connection
between two physical database servers
that allows a client to access them as
one logical database.
See Dabtabase links at Oracle Database Administrator's Guide.
You can use Oracle's export and import utilities
You might want to give Data Pump a try as well (depending on your version). Many options for moving around data from Oracle -> Oracle dbs
Another option is the SQL*Plus copy command. It's not very fast, but it can be very convenient in certain contexts.
Oracle's SQL developer tool has the option to export data as insert statements.

clone oracle database without data

I want to clone my existing oracle database structure without data including packages, users, tablespaces etc. I read some methods but they all copied data as well. Is there anyway out in order to do this?
Thanks in advance.
Use SQL Developer > Tools > Database Export..
On "Specify Data" do not include any tables.
Omit packages etc here,
Fine tune your selection here,
My trial export has not finished yet but I expect this will work.
Use Oracle exp.exe utility for export. E.g.
EXP.EXE login/password#TNSNAME file=entire_db.dmp owner=(scott, my_user, user2) rows=n grants=y triggers=y
Only rows=n option in command above make sense for your task.
You can import to target database with imp.exe utility.
Look for detailed option list and definition by running this utilities with help=y option.
BUT tablespaces and users on target databases must be created manually before running import.
There are no standard tablespace cloning tools (including SQL Developer), but some queries exists for generating such cloning scripts.
Examples can be found here and here.
P.S. This question better fits to ServerFault than to StackOverflow ...
You can do it in toad but its not free tool. (Database Tab->Export->Export DDL)
Try Oracle Export command with ROWS=N
exp SCOTT/TIGER ROWS=N TRIGGERS=N
Use SQL Developer, Tools > Database Export.
You will need to specify at least one table in the 'data' option because you cannot choose to NOT export any data. Pick a table that has a small number of rows or create a dummy table without any rows beforehand as a workaround.

oracle express detatach

Hi I am new and I am used to MS SQL Manager's Attach/Detatch functionality to drop a database into a single file so I can move it to other computers/SQL instances. In a nut shell, this is what I want to do.
I have a large Oracle Express database (instance name Zeus) that I need to move onto other Oracle Express instances (brand new installs) and then later I need to keep them updated with Zeus' database.
How do I do this?
I am not understanding how to export the database/schema - user definition/permission, table definitions, and table data.
Thanks guys
I don't believe you can easily do that with Oracle (especially XE edition).
You would usually do an Import/Export. This would give something like :
expdp system/password#XE DUMPFILE=expfull.dmp FULL=y
impdp system/password#XE DUMPFILE=expfull.dmp FULL=y
The expfull.dmp files would be located in a folder named oradata/dpdump in the Oracle XE
installation.
You could also use Transportable Tablespaces as described here and summarized here.
Another method involves 10 steps and would have to be adapted to Oracle XE. I mention it here for reference.

Resources