oracle user table space

Detailed spatial concept table
1. Plus system user login SQL:
SYS, System; sysman; scott
user login format: [username / password] [@server] [AS sysdba | SYSOPER]
                        System / orcl @orcl AS sysdba 

                        Note: orcl is the name of the service set up their own system / orcl

If you are already logged in with a user SQL Plus, switching logged in user:
                        Connect SYS / orcl AS sysdba 

                        Note: Writing is not case sensitive

2. Review the logged-on user
show user 

Note: sqlplus command entered semicolon is not required when the input is a need to add a semicolon when sql statement

By "data dictionary" -dba_users (tables provided by the database, but also by a number of fields) to view a user's other information fields
to view the data dictionary fields:

desc dba_users
through the data dictionary to see how many users:

dba_users username from the SELECT;
3. Enable (scott) the user's statement:
using the scott user login sqlplus: (scott user default password is Tiger)
Connect scott / Tiger
4. Table space overview:
Table space:

        Logic storage space of the database can be understood as a space open in the database used to store the database objects;

Table spaces and data files of the relationship:

        Tablespace by one or more data files; size and location can define their own data files;

Classification space:
    permanent tablespace: Database some objects to permanent storage, such as: tables, views, stored procedures,
    temporary tablespace: during intermediate database operation which executed after the execution content storage will be automatically released
    UNDO table space: to hold firm to modify the data of the old values, you can roll back the data
5. Review the user table space:
① data Dictionary

dba_tablespaces (system administrator-level view of the data dictionary)

user_tablespaces (ordinary users to view data dictionary)

. ② view the table space field
desc dba_tablespaces
. ③ view there are several table space
the SELECT tablespace_name from dba_tablespaces;
⑤ view the user field information.
Desc dba_users
⑥ view the user's default table space, temporary table space and so on.
The SELECT default_tablespace from the WHERE dba_users = username 'SYS';
6. set the user's default or temporary table space
alter user username default | tempporart tablespace tablespace_name ;
 Note: the average user is not set permissions table space
7. create, modify, delete table space
① create a table space.
the create [temporary] tablespace tablespace_name tempfile | datafile 'xx.dbf' size xx;
NOTE: If you create a temporary table space, the need to add temporary key;
② view the table space :( specific path through dba_data_files and dba_temp_files the data dictionary. )
desc dba_data_files
SELECT file_name from dba_data_files WHERE tablespace_name = "; (with the proviso that tablespace name, capitalized)
. ③ modify the state of the tablespace
Set online or offline status (Table space is not available offline, the default is on-line)
the ALTER TABLESPACE tablespace_name Online | Offline;
How do we know the table space in which state? (By this dba_tablespaces data dictionary)
desc dba_tablespaces
the SELECT Status from dba_tablespaces the WHERE tablespace_name = "; (provided that the name of the table space, you need capital)
to set read-only or read-write state (only be changed online, the default online status is read-write)
ALTER tABLESPACE tablespace_name Read only | Read Write;
④ modified data file
to increase the data file
ALTER tABLESPACE tablespace_name the Add datafile 'xx.dbf' size XX;
SELECT file_name from dba_data_files WHERE tablespace_name = "; (with the proviso that tablespace name, required capital)
Note: by this select statement to query the current data file table space
delete data files (can not be deleted table spaces among the first data file, if you want to delete you need to delete the entire table space)
the ALTER tABLESPACE drop datafile tablespace_name 'xx.dbf';
. ⑤ to delete tablespace
drop tablespace tablespace_name [including contents];
NOTE: If you just delete the table space does not delete data files in the table space, no Contents plus Including;
 
---------------------
Author: crazy duck eggs
source: CSDN
original: https: //blog.csdn.net/guo_cw/article/details/80530726
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/xiaohuizhenyoucai/p/11101547.html