oracle操作簡單的命令

2021-08-25 07:38:20 字數 2756 閱讀 8559

create tablespace hello //建立表空間

datafile 'd:/1.dbf'

size 5m

extent management local autoallocate //本地管理表空間

segment space management auto;//自動管理段

//建立使用者

create user root identified by "root"//登陸

default tablespace yd temporary tablespace temp;

//授權使用者

grant connect to root,

grant resource to root,

grant unlimited tablespace;

drop tablespace 表空間名

-----

監聽,乙個例項

監聽啟動 isnrctl start

啟動例項

oradim -startup -sid orcl

建立使用者

create user yoscar identified by yoscar

建立session 會話許可權

grant create session to yoscar

分配建立表的許可權

grant create table to yoscar

建立表空間

grant unlimited tablespace

撤銷許可權

revoke create table from yoscar

檢視當前使用者具有的哪些許可權

select * from user_sys_privs;

修改密碼,

alter user scott identified by tiger

--linux下啟動oracle

isnrctl start 啟動監聽 接受使用者請求

sqlplus / as sysdba //連線進去,不登陸

conn sys/oracle as sysdba //用sys使用者連線

startup

--windows下oracle啟動過程

lsnrctl start//先啟動監聽,然後啟動例項

oradim -startup -sid orcl

sys密碼丟了修改,oracle/products/10.2.0/db_2/database pwdorcl.ora

orapwd file=d:oracle/products/10.2.0/db_2/database/pwdorcl.ora passwd=123456 entries=10;

檢視使用者

select * from v$pwfile_users;

讓所有的擁有建立的許可權

-----

create tablespace welcome

datafile 'd:/welcome.dbf'

size 5m

extent management local autoallocate

segment space management auto;

create user root identified by "root"

default tablespace welcome temporary tablespace temp;

//授權使用者

grant connect to root

grant resource to root

grant unlimited tablespace to root

//先把錶空間設定成唯讀

alter tablespace welcome read only ;

exp 'root/root as sysdba' transport_tablespace=y tablespaces=(welcome) file=c:\welcome.dmp;

修改表空間的讀寫屬性

alter tablespace testspace read write;

刪除表空間

alter tablespace welcome offline

drop tablespace welcome including contents

刪除使用者

drop user *** cascade;

給root賦予dba的角色許可權

grant dba to root

用imp命令匯入資料表時出現了

經由常規路徑由 export:v10.02.01 建立的匯出檔案

imp-00013: 只有 dba 才能匯入由其他 dba 匯出的檔案 imp-00000: 未成功終止匯入

的錯誤,在網上找了一些解決方案,現找到一種解決方案,分享如下:

imp時連線使用者沒有dba許可權或者default role不是dba

你可以換個有dba role的使用者imp。

如果你還想用這個使用者,如果這個使用者沒有dba許可權就grant dba to 使用者;

如果default role不是dba,那就 alter user 使用者 default role dba;

如:grant dba to scott

匯出幾個表命令

exp root/root@orcl file=f:\0720.dmp tables(xs_jxfcm,xx_dmjlb,xx_dmjxx)

匯出表空間命令

exp root/root@orcl file=f:\0720.dmp

MySQL的簡單操作命令

學習nosql的時候,發現可以再回過頭來複習一遍mysql,當初學資料庫的時候都是重視理論,發現到做專案的時候,很多語句都不會,所以趁著這個機會,一起把mysql的知識再重新溫習一遍,並做好記錄。資料庫是database,所以就很容易建立了 create database datasource 注 ...

Oracle基本操作命令

author cuizong007 1 啟動資料庫 dbstart 2 關閉資料庫 dbshut 3 oracle使用者解鎖命令 alter user 使用者名稱 account unlock 4 檢視當前使用者命令 show user 5 連線其他使用者 除sys外 命令 conn 使用者名稱 密...

Oracle常用操作命令

一 匯入 匯出 備份與恢復 在dos命令列下,而不是在sql 下 將資料庫orcl完全匯出 exp name pwd orcl file d test.dmp full y 遠端連線並匯出 exp name pwd 192.168.1.167 1521 orcl file c test.dmp 將s...