Some Common commands and tips in SQL * Plus

Source: Internet
Author: User

SQL> show user; displays the current user (dedicated in the SQL * Plus tool, the better way is to use SQL> Select User from dual; statement to view the current user, the dual table is an oracle table that every SQL * Plus user can use. Here, it is really important to know That it only contains one row of data .);
SQL> set pagination E 20; set the number of lines displayed on each page to 20;
SQL> set linesize 100; set the number of characters displayed in each line to 100. (if it is difficult to set each time, you can save the two statements in C: \ oracle \ ora92 \ sqlplus \ admin \ glogin. in SQL, Oracle automatically runs glogin each startup. SQL file, equivalent to initialization)
SQL> show all; view the current environment settings;
SQL> spool file_name; outputs the displayed content to a specified file, for example, Spool c: \ spool.txt;
SQL> spool off; Disable spool output. The output content is displayed in the output file only when spool output is disabled;
SQL>/; run the last command again;
SQL> set timing on/off; display and close the execution time of each SQL statement;
SQL> select * From tab; view all tables under the current user;
SQL> Start file_name; or SQL> @ file_name; execute an SQL script file. We can save multiple SQL statements in one text file, in this way, when you want to execute all the SQL statements in this file, use any of the following commands, which is similar to batch processing in DOS;
SQL> DESC table_name; displays the table structure;
Quick copy and paste in SQL * Plus (from www.cnoug.org ):
1) move the cursor to the beginning of the content you want to copy
2) press the left mouse button with the right index finger
3) drag the mouse to the other corner of the content to be copied, just like the method used to select the content in word.
4) after the content is selected (all selected content is reversed), press and hold the left mouse button, and right-click the right hand
5) The selected content is automatically copied to the last line of the SQL * Plus environment.

1.8 Super User Password forgot Handling Method
1. Enter sqlplusw/nolog to log in during the start operation, that is, do not start the service login.
2. Use $ Net start oracleservicechstone and $ Net start oracleorahome92tnslistener to start two services.
3. Connect to the Database SQL> connect/As sysdba as a super user;
4. modify the system password: SQL> alter user system identified by "password ".

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.