oracle資料庫操作

來源:互聯網
上載者:User

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

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

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

Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.

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 "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", 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/>

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.