oracle資料庫操作

2021-09-22 09:14:20 字數 3710 閱讀 9712

1.建表空間

create tablespace ccpbs datafile '/home/oracle/bossdata/ora_data/ccpbs_index01.dbf' size 100m reuse default storage(initial 5000k next 5000k pctincrease 20);

2.建使用者

create user osuser identified by osuser;//identified by 後面的是密碼,前面的是使用者名稱

3.使用者授權

grant resource,connect,recovery_catalog_owner to osuser ;

grant create table to osuser ;

alter user osuser quota unlimited on osdb;

alter user osuser default tablespace osdb;

4.刪除表空間

drop tablespace tablespacename including contents and datafiles;

5.刪除使用者

drop user user_name cascade

6.刪除表的注意事項

在刪除乙個表中的全部資料時,須使用truncate table 表名;因為用drop table,delete * from 表名時,tablespace表空間該錶的占用空間並未釋放,反覆幾次drop,delete操作後,該tablespace上百兆的空間就被耗光了。

7.啟動資料庫

/home/channel/>su - oracle        //切換到oracle使用者下

password: 

/home/oracle/>sqlplus /nolog      //鏈結

sql*plus: release 9.2.0.7.0 - production on wed apr 15 10:11:26 2009

sql> conn /as sysdba         //用dba身份

connected to an idle instance.

sql> startup                     //啟動

oracle instance started.

total system global area  856758052 bytes

fixed size       452388 bytes

variable size    318767104 bytes

database buffers   536870912 bytes

redo buffers       667648 bytes

database mounted.

database opened.

sql> exit                              //推出oracle sqlplus

disconnected from oracle9i enterprise edition release 9.2.0.7.0 - production

with the partitioning, olap and oracle data mining options

jserver release 9.2.0.7.0 - production

/home/oracle/>lsnrctl start           //啟動監聽

lsnrctl for linux: version 9.2.0.7.0 - production on 15-apr-2009 10:15:23

starting /opt/oracle/product/9.2.0.4/bin/tnslsnr: please wait...

tnslsnr for linux: version 9.2.0.7.0 - production

system parameter file is /opt/oracle/product/9.2.0.4/network/admin/listener.ora

log messages written to /opt/oracle/product/9.2.0.4/network/log/listener.log

listening on: (description=(address=(protocol=tcp)(host=usboss)(port=1521)))

listening on: (description=(address=(protocol=ipc)(key=extproc0)))

connecting to (description=(address=(protocol=tcp)(host=usboss)(port=1521)))

status of the listener

------------------------

alias                     listener

version                   tnslsnr for linux: version 9.2.0.7.0 - production

start date                15-apr-2009 10:15:24

uptime                    0 days 0 hr. 0 min. 0 sec

trace level               off

security                  off

snmp                      off

listener parameter file   /opt/oracle/product/9.2.0.4/network/admin/listener.ora

listener log file         /opt/oracle/product/9.2.0.4/network/log/listener.log

listening endpoints summary...

(description=(address=(protocol=tcp)(host=usboss)(port=1521)))

(description=(address=(protocol=ipc)(key=extproc0)))

services summary...

service "pl***tproc" has 1 instance(s).

instance "pl***tproc", status unknown, has 1 handler(s) for this service...

service "ccpbs" has 1 instance(s).

instance "ccpbs", status unknown, has 1 handler(s) for this service...

the command completed successfully

/home/oracle/>

oracle資料庫操作

1 oracle安裝目錄,配置目錄 通過環境變數查詢 set grep oracle 網路配置在 oracle home network admin tnsnames.ora 2 oracle資料庫 select from v database 3 oracle表 4 oracle 工具 linux...

Oracle資料庫操作。

物件導向告一段落,重新撿起來sql server的知識,幸好資料庫語言都差不多,讓我重新學習oracle的時候並沒有想象中的費勁,只需要複習起來舊知識,再融合oracle特有的語法就足矣。廢話不多說,進入正題,此文章按照網上的資料 個人理解編寫,盡量做到通俗易懂,以便日後忘了能夠見文知意。注 sql...

Oracle資料庫操作

執行匯入命令 匯入時需要用準備工作中建立的新使用者,如 使用者名稱abc,密碼abc imp 使用者名稱 密碼 file dmp 檔案路徑 log 輸出日誌路徑 full y ignore y imp abc abc file home oracle iom.dmp log home oracle ...