Oracle常用命令1(数据库、表空间)
登陆oracle
Sqlplus 用户名/密码@服务器名
创建数据库(建议使用oracle自带的程序:Database Configuration Assistant):
CREATE DATABASE "orcl"
controlfile 控制文件名称
maxdatafiles 500
maxinstances 8
maxlogfiles 32
character set ZHS16GBK
national character set ZHS16GBK
DATAFILE '/path/system01.dbf' SIZE 200M
logfile group 1 ('/path/app1_redo01.log',
'/path/app1_redo01.log') SIZE 20M,
group 2 ('/path/app1_redo02.log',
'/path/app1_redo02.log') SIZE 20M,
group 3 ('/path/app1/app1_redo03.log',
'/path/app1_redo03.log') SIZE 20M;
创建表空间:
CREATE TABLESPACE tablespacename DATAFILE ‘filename’ [SIZE integer [K|M]] [AUTOEXTEND [OFF|ON]];
如:create tablespace ts_eb datafile 'e:/ts_eb.dbf' size 10m autoextend on;
创建表空间后,增加数据文件:
ALTER TABLESPACE "tablespace_name" ADD DATAFILE 'data_file_path/data_file_name' SIZE <the data file size you designed>
删除表空间
drop tablespace tablespace_name including contents and datafiles;
查看表空间信息:select * from dba_tablespaces;
查看当前oracle版本
select * from v$version;