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

 

 本文转自茄子_2008博客园博客,原文链接:http://www.cnblogs.com/xd502djj/archive/2009/02/26/1398761.html,如需转载请自行联系原作者。


目录
相关文章
|
8天前
|
SQL Oracle 关系型数据库
【Oracle】玩转Oracle数据库(一):装上去,飞起来!
【Oracle】玩转Oracle数据库(一):装上去,飞起来!
44 7
|
25天前
|
Oracle 关系型数据库 数据库
Oracle数据库基本概念理解(3)
Oracle数据库基本概念理解(3)
18 2
|
8天前
|
SQL Oracle 关系型数据库
【Oracle】玩转Oracle数据库(七):RMAN恢复管理器
【Oracle】玩转Oracle数据库(七):RMAN恢复管理器
35 5
|
25天前
|
Oracle 关系型数据库 数据库
Oracle数据库基本概念理解(2)
Oracle数据库基本概念理解(2)
13 1
|
8天前
|
存储 SQL Oracle
【Oracle】玩转Oracle数据库(二):体系结构、存储结构与各类参数
【Oracle】玩转Oracle数据库(二):体系结构、存储结构与各类参数
32 7
|
25天前
|
Oracle 关系型数据库 数据库
Oracle数据库基本概念理解(1)
Oracle数据库基本概念理解(1)
12 1
|
25天前
|
Oracle 关系型数据库 MySQL
Seata常见问题之oracle 数据库 报 just support mysql如何解决
Seata 是一个开源的分布式事务解决方案,旨在提供高效且简单的事务协调机制,以解决微服务架构下跨服务调用(分布式场景)的一致性问题。以下是Seata常见问题的一个合集
53 0
|
1月前
|
Oracle Java 关系型数据库
SpringBoot整合Mybatis连接Oracle数据库
SpringBoot整合Mybatis连接Oracle数据库
SpringBoot整合Mybatis连接Oracle数据库
|
1月前
|
存储 Oracle 关系型数据库
Oracle系列十六:数据库备份
Oracle系列十六:数据库备份
|
1月前
|
SQL Oracle 关系型数据库
Oracle数据库启动时:ORA-00119: invalid specification for system parameter LOCAL_LISTENER;
Oracle数据库启动时:ORA-00119: invalid specification for system parameter LOCAL_LISTENER;