Common Oracle commands

Source: Internet
Author: User

Common Oracle commands
1. Connect to the database

Connect user name/Password
Example: connect Scott/tiger; equivalent to conn Scott/tiger;

2. Disconnect

Disconnect is equivalent to disconn;

3. Change the user's password

Password is used to change the password of a user. If you want to change the password of another user, you need to use sys or system to log on;
Example:
① Change the password of the Login User Name
Password press ENTER
Enter the old password and press enter as prompted;
② Change the password of another user name
Password username press ENTER
Enter the old user password and press enter as prompted;

4. display the Login User Name

Show user;

5. Exit Oracle SQL * Plus

Exit;

Vi. File Operation commands

① Execute the SQL statement in the file
In the root directory of drive D, there is an AA. SQL file with the content select * from EMP;
Example: Start D: \ AA. SQL Press enter. The output result is displayed.
Equivalent to @ D: \ AA. SQL carriage return;
② Editing files
Edit D: \ AA. SQL enter; you can edit it in the text editor.
③ Save the content on the screen to a file
Example: requirement: Select * from EMP; Save the output result to the BB. SQL file in the root directory of drive D;
Spool D:, BB. SQL;
Select * from EMP;
Spool off;
You can open the BB. SQL file on disk D, and the output results on the screen will be saved in this file;

7. input parameters on the keyboard to obtain the output result.

Example: Select * from EMP where ename = & name;
Press enter to jump out of the dialog box and enter the condition value to get the query result;

8. Set and display environment variables

① Display the row width. The default value is 80 characters.
Show linesize;
② Set the row width
Set linesize 120;
③ Number of display pages
Show pagesize;

④ Set the number of pages

Set pagesize 4;

Welcome to my website: www.yehuchina.org

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.