oracle操作的基本命令

2021-06-26 09:08:25 字數 1033 閱讀 4994

1.oracle

(1) 啟動 監聽

lsnrctl start;

(2)進入sqlplus介面

sqlplus  /nolog

sql>conn sys/jiaxiaoai@orcl as sysdba;

(3)啟動資料庫例項

sql>startup;

(4)檢視當前所有的資料庫

select * from v$database;

或 select name from v$database;

(5)檢視哪些使用者擁有sysdba、sysoper許可權

select * from v_$pwfile_users;

show user;檢視當前資料庫連線使用者

(6)進入某個資料庫:database 資料庫名;

檢視資料庫結構:desc v$database;

(7)檢視所有使用者例項:

select * from v$instance;

或 select instance_name from v$instance;

(8)檢視當前庫的所有資料表

select * from all_tables;

select table_name from all_tables;

select table_name from user_tables;

select table_name from all_tables where owner='使用者名稱';

(9)檢視表結構

desc 表名;

(10)增加資料庫使用者

create user 使用者名稱 identified by 密碼 default tablespace users temporary tablespace temp;

(11)使用者授權

grant connect,resource,dba to 使用者名稱;

grant sysdba to 使用者名稱;

(12)更改資料庫使用者密碼

alter user 使用者名稱 identified by 密碼;

oracle 表操作基本命令

1 建立表 create table chent2 c varchar2 32 not null,user name varchar2 32 2 修改表結構 alter table 命令 2.1修改列名 rename 命令 alter table chent2 rename column ids t...

oracle基本命令

1 describe查詢表結構 describe xuesheng 名稱 空值 型別 id number 38 xing ming varchar2 25 yu wen number shu xue number 2 select 列名稱 from 表名稱 select from xuesheng ...

oracle基本命令

sqlplus 鏈結oracle資料庫 sqlplus as sysdba 1 檢視當前的資料庫檔案一般都是放在 select name from v datafile 2 建立表空間 create tablespace 表空間名 datafile 對應的檔名 size 大小 3 建立使用者 cre...