Record your actions and results in a sqlplus environment

Source: Internet
Author: User

Contact the Author: xiaozuidaizhi@sina.com




You need to use the following command:
<sql>spool filename. file suffix
<SQL> a series of operations and operational results
<sql>spool off
In this way, you can store the results of the statements and actions of the operation as text in the file you created--"filename. File format"
The file is saved in the
If OS is Linux then user directory
If OS is Windows then sysdir\documents and Settings\ User Directory

---------------------------------------------------------------------------------------------
Spool is to establish a channel and indicate the file name and format

---------------------------------------------------------------------------------------------

Below, for example: Create a database of user table delete files

<sql>spool Droptables.sql

<sql>select ' drop table ' | | table_name | | ' cascade constraints; ' from User_tables;

<sql>spool off

"||" As a connector and accepted for SQL syntax in Oracle, the SQL statement described above is used in | | The String ' drop table '
and string ' cascade constraints; ' Connected together, of course, also connected to the table name table_name;
Then, you can find the SQL file in the appropriate directory, and later, if you need to delete a large number of tables, you can create such a file, of course, if you want to record other operations and results, you can do so.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.