1,表空间

(1)创建一个表空间,表空间名字叫test_tablespace

 
  
  1. create tablespace test_tablespace    

(2)表空间的文件存放的路径以及文件的名字

 
  
  1. datafile 'D:\oracle\product\10.2.0\db_1\oradata\test_tablespace.dbf' 

 (3)表空间的大小以及其自动扩展的大小

 
  
  1. size 200m autoextend on next 10m maxsize 20480m; 

(4)与上面类似,创建一个临时表空间test_tablespace_tmp

(5)彻底删除表空间(表空间以及表空间文件),可以用pl/sql中的tablespace找到test_tablespace,右键删除,或者用sql删除(级联删除),建议不要这样使用

 
  
  1. drop tablespace test_tablespace including cascade

(6)只删除表空间

 
  
  1. drop tablespace test_tablespace; 

(7)只删除表空间,没有删除表空间文件,然后重建这个表空间

 
  
  1. create tablespace test_tablespace 
  2. datafile 'D:\oracle\product\10.2.0\db_1\oradata\test_tablespace.dbf' 
  3. size 200m autoextend on next 10m maxsize 20480m; 

2,账户

(1)创建用户,名为test,其密码为test

 
  
  1. create user test identified by test 

(2)修改用户名。有两个方法,一是用exp的方法将用户信息导出,然后删掉这个用户,再重新创建一个新用户,将用户信息导入到新用户里面。第二个方法是:

 
  
  1. 以dba登陆 
  2. conn / as sysdba; 
  3. 查询需要更改的用户名(必须大写) 
  4. select user#,name,password from userwhere name='TEST'
  5.     USERNAME                           PASSWORD  
  6. ---------- ------------------------------ --------------------------- 
  7.        78 TEST                       21EDA78F89D6FACD  
  8. update userset name='TEST_BAK' where user#=78; 

用户指向默认的表空间