• oracle数据库操作


    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/>

     

     

  • 相关阅读:
    Java面试系列05(static、JVM内存模、final、abstract、interface)
    Java面试系列04(抽象、实例化、类、多态、对象、特殊对象、权限封装)
    第一个spring冲刺团队贡献分(80分满分)
    第二个Sprint冲刺第一天
    第一阶段的事后诸葛亮
    第一个Sprint冲刺成果
    第一个Sprint冲刺第十天
    第一个Sprint冲刺第九天
    第一个Sprint冲刺第八天
    第一个Sprint冲刺第七天
  • 原文地址:https://www.cnblogs.com/xd502djj/p/1398761.html
Copyright © 2020-2023  润新知