Sort and summarize common Oracle commands-for your convenience

Source: Internet
Author: User


Sort out and summarize common Oracle commands-this error occurs when you and I perform batch Hibernate inserts. org. hibernate. QueryTimeoutException:
The cause of the error is that the tablespace capacity is insufficient and you need to increase the space capacity. The first thought is to query its capacity, so you should find a way to query its capacity and increase its capacity. Therefore, we want to organize the commonly used command statements in Oracle in a unified manner. We will continue to update this blog in the future. To facilitate query in the future, sort out this blog. Www.2cto.com
Common commands in Oracle are as follows: 1. create user Username identified by password note: the username and password should be in English, for example, create user sms identified by sms; 2. create a tablespace create tablespace name datafile 'Storage path' size, for example, create tablespace ts_sms datafile 'f: \ quanxianguanliruanjian \ oracle \ tablespace \ sms. dbf'size 100 m;
3. assign the tablespace value to the created user alter user default tablespace, for example, alter user sms default tablespace ts_sms; 4. grant permissions to grant create session, create view, create table, and unlimited tablespace to users such as grant create session, create view, create table, and unlimited tablespace to sms; or assign all the DBA permissions to the user, so that the user has the permissions such as create sequence grant dba to user; for example: grant dba to sms;
5. Switch to the new user to log on to www.2cto.com conn user/password such as conn sms/sms. 1-5 indicates the process between creating a user and importing SQL. 6. Delete the user drop user username, for example, drop user sms; 7. Modify the user's password, alter user username, identified by, and new password, for example, alter user test identified by test;
8. view All users select * from dba_users; or select * from all_users; or select * from user_users; where select * from user_users; only the current user 9 can be viewed. view the permissions of the current user or DBA role select * from user_sys_privs; select * from dba_sys_privs; 10. view the tablespace capacity www.2cto.com SQL> selecttablespace_name "tablespace", bytes/1024/1024 "total capacity MB" fromdba_data_files; the result is as follows:

11. view the usage of the tablespace.
SQL> selecta. tablespace_name as tablespace,. bytes/1024/1024 as total capacity MB, (. bytes-b.bytes)/1024/1024 "use capacity MB", B. bytes/1024/1024 "remaining capacity MB", round (. bytes-b.bytes)/. bytes) *) "percent used" from (select tablespace_name, sum (bytes) bytes fromdba_data_files group by tablespace_name) a, (select tablespace_name, sum (bytes) bytes, max (bytes) largest from dba_free_space group by tablespace_name) B where. tablespace_name = B. tablespace_nameorder by (. bytes-b.bytes)/. bytes) desc; the result is as follows:

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.