Oracle - How to generate script from sql developer

后端 未结 10 491
臣服心动
臣服心动 2020-12-07 20:13

How to take script for schema of the tables, stored procedures of Oracle through SQL Developer tool (SQLPLUS command line interface)?

相关标签:
10条回答
  • 2020-12-07 20:54

    use the dbms_metadata package, as described here

    0 讨论(0)
  • 2020-12-07 20:58

    This worked for me:

    • In SQL Developer, right click the object that you want to generate a script for. i.e. the table name
    • Select Quick DLL > Save To File
    • This will then write the create statement to an external sql file.

    Note, you can also highlight multiple objects at the same time, so you could generate one script that contains create statements for all tables within the database.

    0 讨论(0)
  • 2020-12-07 21:01

    This worked for me:

    PL SQL Developer -> Tools -> Export User Objects

    Select checkboxes: Include privilege and Include storage

    Select your file name. Hit export.

    You can later use generated export file to create table in another schema.

    0 讨论(0)
  • 2020-12-07 21:08

    If you want to see DDL for the objects, you can use

    select dbms_metadata.get_ddl('OBJECT_TYPE','OBJECT_NAME','OBJECT_OWNER') 
      from dual
    /
    

    For example this will give you the DDL script for emp table.

    select dbms_metadata.get_ddl('TABLE','EMP','HR') 
      from dual
    /
    

    You may need to set the long type format to big number. For packages, you need to access dba_source, user_source, all_source tables. You can query for object name and type to see what code is stored.

    0 讨论(0)
  • 2020-12-07 21:10

    step 1. select * from <tablename>;

    step 2. just right click on your output(t.e data) then go to last option export it will give u some extension then click on your required extension then apply u will get new file including data.

    0 讨论(0)
  • 2020-12-07 21:11

    In Oracle the location that contains information about all database objects including tables and stored procedures is called the Data Dictionary. It is a collection of views that provides you with access to the metadata that defines the database. You can query the Data Dictionary views for a list of desired database objects and then use the functions available in dbms_metadata package to get the DDL for each object. Alternative is to investigate the support in dbms_metadata to export DDLs for a collection of objects.

    For a few pointers, for example to get a list of tables you can use the following Data Dictionary views

    • user_tables contains all tables owned by the user
    • all_tables contains all tables that are accessible by the user
    • and so on...
    0 讨论(0)
提交回复
热议问题