標籤:http io ar 使用 sp 檔案 資料 on art
#注意:例子中的oralce命令在/home/oracle/oracle/product/10.2.0/db_1/bin目錄。#你可以自己修改成自己的目錄。
A.#dbstart //啟動資料庫
#dbshut //關閉資料庫
B.#emctl start dbconsole //開啟企業管理器
#emctl stop dbconsole //關閉企業管理器
C.#lsnrctl start //啟動監聽
#lsnrctl stop //關閉監聽
D.#emctl start agent //開啟代理
#emctl stop agent //關閉代理
E.#sqlplus /nolog
conn / as sysdba
startup //啟動執行個體
shutdown immediate //關閉執行個體
F.#tnsping 192.168.1.104 //測試Oracle資料庫是否通
G.http://10.0.0.77:5560/isqlplus //isQL*Plus URL
http://10.0.0.77:5560/isqlplus/dba //isQL*Plus DBA URL
http://10.0.0.77:1158/em //Enterprise Manager 10g Database
- 建立資料表空間和使用者的步驟:
- 使用者
- 建立:create user 使用者名稱 identified by "密碼";
- 授權:grant create session to 使用者名稱;
- grant create table to 使用者名稱;
- grant create tablespace to 使用者名稱;
- grant create view to 使用者名稱;
- 資料表空間
- 建立資料表空間(一般建N個存資料的資料表空間和一個索引空間):
- create tablespace 資料表空間名
- datafile ‘ 路徑(要先建好路徑)\***.dbf ‘ size *M
- tempfile ‘ 路徑\***.dbf ‘ size *M
- autoextend on --自動成長
- --還有一些定義大小的命令,看需要
- default storage(
- initial 100K,
- next 100k,
- );
- 使用者權限
- 授予使用者使用資料表空間的許可權:
- alter user 使用者名稱 quota unlimited on 資料表空間;
- 或 alter user 使用者名稱 quota *M on 資料表空間;
- --匯入匯出命令
- ip匯出方式: exp demo/[email protected]:1521/orcl file=f:/f.dmp full=y
- exp demo/[email protected] file=f:/f.dmp full=y
- imp demo/[email protected] file=f:/f.dmp full=y ignore=y
查看錶空間檔案所在目錄:
select * from dba_data_files;
ORACLE資料字典視圖的種類分別為:USER,ALL 和 DBA.
USER_*:有關使用者所擁有的對象資訊,即使用者自己建立的對象資訊
ALL_*:有關使用者可以訪問的對象的資訊,即使用者自己建立的對象的資訊加上
其他使用者建立的對象但該使用者有權訪問的資訊
DBA_*:有關整個資料庫中對象的資訊
(這裡的*可以為TABLES,INDEXES,OBJECTS,USERS等。)
1、查看所有使用者
select * from dba_user;
select * from all_users;
select * from user_users;
2、查看使用者系統許可權
select * from dba_sys_privs;
select * from all_sys_privs;
select * from user_sys_privs;
3、查看使用者物件許可權
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
4、查看所有角色
select * from dba_roles;
5、查看使用者所擁有的角色
select * from dba_role_privs;
select * from user_role_privs;
6、查看目前使用者的預設資料表空間
select username,default_tablespace from user_users;
7、查看某個角色的具體許可權
如grant connect,resource,createsession,create view to TEST;
8、查看RESOURCE具有那些許可權
用SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE=‘RESOURCE‘;
SQL code
--刪除空的資料表空間,但是不包含物理檔案
drop tablespace tablespace_name;
--刪除非空資料表空間,但是不包含物理檔案
drop tablespace tablespace_name including contents;
--刪除空資料表空間,包含物理檔案
drop tablespace tablespace_name including datafiles;
--刪除非空資料表空間,包含物理檔案
drop tablespace tablespace_name including contents and datafiles;
--如果其他資料表空間中的表有外鍵等約束關聯到了本資料表空間中的表的欄位,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;
linux下Oracle 相關命令