Export table names starting with 'CE'

 By creating a custom view or selecting the data you want with a query and then exporting that view or the query result using exp.

Here's how you can do it:

  1. Create a View: Create a view that represents the data you want to export.
CREATE VIEW export_view AS
SELECT column1, column2, column3
FROM your_table_name
WHERE conditions;

Replace column1, column2, column3, your_table_name, and conditions with appropriate values for your scenario.

  1. Export the View: Once you have created the view, you can export it using the exp command.

exp username/password@SID file=schema_name.dmp log=schema_name.log tables=export_view

Replace username, password, SID, schema_name.dmp, and schema_name.log with appropriate values.

This approach allows you to export data based on the criteria defined in the view. The exported data will include the results of the query defined in the view.


Alternatively

Here's an example of how you can achieve this using a Unix/Linux shell script:

#!/bin/bash # Set Oracle environment variables export ORACLE_HOME=/path/to/oracle_home export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=your_sid # SQL query to get the table names starting with 'CE' sqlplus -s username/password <<EOF SET PAGESIZE 0 SET FEEDBACK OFF SET HEADING OFF SET VERIFY OFF SPOOL ce_tables.txt SELECT table_name FROM user_tables WHERE table_name LIKE 'CE%'; SPOOL OFF EXIT EOF # Read table names from the output file and export each table while read -r table_name; do exp username/password tables="$table_name" file="${table_name}_export.dmp" log="${table_name}_export.log" done < ce_tables.txt

Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post