启动:
关闭:
创建表空间:
注意$代表shell命令提示符,这里的oracle是9.0以上版本。
$ su - oracle
$ sqlplus / nolog
sql> conn / as sysdba
sql> startup (一般不需要加参数,只要设置好环境变量)
sql> quit (退出sql模式)
$ lsnrctl start (启动监听器)
关闭:
$ lsnrctl stop(关闭监听器,在这之前,应该先关闭应用程序)
$ sqlplus /nolog
sql>shutdown 其参数 :
shutdown有四个参数,四个参数的含义如下:
Normal 需要等待所有的用户断开连接
Immediate 等待用户完成当前的语句
Transactional 等待用户完成当前的事务
Abort 不做任何等待,直接关闭数据库
normal需要在所有连接用户断开后才执行关闭数据库任务,所以有的时候看起来好象命令没有运行一样!在执行这个命令后不允许新的连接
immediate在用户执行完正在执行的语句后就断开用户连接,并不允许新用户连接。
transactional 在拥护执行完当前事物后断开连接,并不允许新的用户连接数据库。
abort 执行强行断开连接并直接关闭数据库。
前三种方式不回丢失用户数据。第四种在不的已的情况下,不建议采用!
创建表空间:
create tablespace testspace datafile '/usr/oracle10/oradata/test/test01.dbf' size 300M reuse default storage (initial 64K next 64K pctincrease 0);
create temporary testtablespace testtemp tempfile '/usr/oracle10/oradata/test/testtemp01.dbf' size 100M reuse ;
create user testuser identified by testuser;
grant resource, connect to testuser;
alter user testuser default tablespace testspace;
alter user testuser temporary tablespace testtablespace;