Knowledge about common oracle database system users, logon statements, and logon users.

Source: Internet
Author: User

Knowledge about common oracle database system users, logon statements, and logon users.
Common system users (permission arrangement)

Sys> system> sysman> scott

Scott default password tiger

Logon statement:

System/password or connect sys/password as sysdba

View logon users

View Current user: show user

View user data dictionary: desc dba_users

View the user information in the data dictionary: select username from dba_users;

Enable scott user

Enable user: alter user username account unlock;

Data Dictionary viewed by administrator users: dba_tablespaces, user_tablespaces, dba_users, and user_users data dictionary viewed by common users: user_tablespaces

Destcba_tablespaces

View the user's tablespace (in the corresponding data dictionary)

Select tablespace_name from dba_tablespaces | user_tablespaces;

View the default or temporary tablespace of a user (SYSTEM)

Select default_tablespace, temporary_tablespace from dba_users where username = 'system ';

Note: When searching, the field value must be in uppercase!

Set the user's default or temporary tablespace

Alter user username default | temporary tablespace tablespace_name;

For example, alter user system default tablespace system;

Create a tablespace [temporary tablespace]

CREATE [TEMPORARY] TABLESPACE tablespace_name DATAFILE | TEMPFILE 'xxx. dbf' SIZE xx;

Example: create tablespace test1_tablespace DATAFILE 'test1file. dbf' SIZE 10 m;

Example: create temporary tablespace temptest1_tablespaceTEMPFILE 'tempfile1. dbf' SIZE 10 m;

Find the path of the tablespace data file (using the data dictionary dba_data_files)

Desc dba_data_files

Select file_name from dba_data_files where tablespace_name = 'test1 _ tablespace ';

Note: When searching, the field value must be in uppercase!

View the tablespace status

Destcba_tablespaces

Select status from dba_tablespaces where tablespace_name = 'test1 _ tablespace ';

Note: When searching, the field value must be in uppercase!

Modify tablespace

Modify the tablespace status

OFFLINE: alter tablespace tablespace_name ONLINE | OFFLINE;

For example, alter tablespace test1_tablespace OFFLINE;

READ/WRITE status: alter tablespace tablespace_name read only | read write;

Example: alter tablespace test1_tablespaceREAD WRITE; (Note: equal to ONLINE)

Add tablespace data files

Alter tablespace tablespace_name add datafile 'xx. dbf' SIZE xx;

Example: alter tablespace test1_tablespaceADD DATAFILE 'test2 _ file. dbf' SIZE 10 m;

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.