01 |
C:\Documents and Settings\Administrator.EB5B29EE6E0C440>sqlplus /nolog |
02 |
03 |
SQL*Plus: Release 10.1.0.2.0 - Production on 星期五 10月 1 17:02:10 2010 |
04 |
05 |
Copyright (c) 1982, 2004, Oracle. All rights reserved. |
06 |
07 |
SQL> conn / as sysdba |
08 |
Connected. |
09 |
10 |
SQL> create tablespace TABLESPACE_NAME datafile 'E:\oracle\product\10.1.0\oradata\orcl\TABLESPACE_DB.dbf' size 512M autoextend on next 50M maxsize 2028M extent management local ; |
11 |
12 |
Tablespace created. |
13 |
14 |
SQL> create user USER_NAME identified by PASSWORD default tablespace TABLESPACE_NAME; |
15 |
16 |
User created. |
17 |
18 |
SQL> grant connect ,resource,dba to USER_NAME; |
19 |
20 |
Grant succeeded. |
21 |
22 |
SQL> exit |
23 |
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production |
24 |
With the Partitioning, OLAP and Data Mining options |
25 |
26 |
C:\Documents and Settings\Administrator.EB5B29EE6E0C440>sqlplus /nolog |
27 |
28 |
SQL*Plus: Release 10.1.0.2.0 - Production on 星期三 10月 6 22:18:32 2010 |
29 |
30 |
Copyright (c) 1982, 2004, Oracle. All rights reserved. |
31 |
32 |
SQL> conn ibsc0930/ibsc0930 |
33 |
Connected. |
34 |
35 |
SQL> @E :\db_bak\my_test.sql; |
36 |
37 |
SQL> exit |
38 |
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production |
39 |
With the Partitioning, OLAP and Data Mining options |
40 |
41 |
C:\Documents and Settings\Administrator.EB5B29EE6E0C440>imp USER_NAME/ PASSWORD @SID file=E:\db_bak\XXX.dmp full =y |
42 |
43 |
44 |
........ |
45 |
// 刪除表空間 |
46 |
SQL> drop tablespace TABLESPACE_NAME including contents and datafiles cascade onstraints; |
47 |
48 |
// 刪除用戶 |
49 |
SQL> drop user USER_NAME cascade ; |
50 |
51 |
// 數據庫導出 |
52 |
exp USER_NAME_N/PASSWORD_N@SID file=d:XXX.dmp owner=(USER_NAME_O,PASSWORD_O) |
53 |
54 |
// 修改密碼 |
55 |
SQL> ALTER USER user_name IDENTIFIED BY password ; |
56 |
57 |
// 修改數據 |
58 |
UPDATE table_name |
59 |
SET column_name = expression |
60 |
WHERE conditions |
61 |
62 |
// 修改表名 |
63 |
ALTER TABLE src RENAME TO dest; |
64 |
65 |
// 修改列名 |
66 |
ALTER TABLE tablename RENAME COLUMN src TO dest; |
67 |
68 |
// 修改列的數據類型 |
69 |
ALTER TABLE tablename MODIFY col VARCHAR2(255); |
70 |
71 |
// 增長列 |
72 |
ALTER TABLE tablename ADD 列名 數據類型 |
73 |
74 |
// 刪除列 |
75 |
ALTER TABLE tablename DROP COLUMN 列名 |
76 |
77 |
// 查詢表空間 |
78 |
select * from sys.dba_tablespaces; |
79 |
80 |
// 查詢用戶 |
81 |
select * from dba_users; |