2024-11-19 Oracle操作

1.创建XXX_DATA 表空间:create tablespace [表空间_DATA] datafile     '/opt/oracle/oradata/[存放表空间和临时表空间dbf文件夹]/[表空间_DATA].dbf' size 2048M extent management local autoallocate; 

create tablespace XXX_DATA datafile     '/opt/oracle/oradata/XXX/XXX_DATA.dbf' size 2048M extent management local autoallocate; 


2.创建XXX_TEMP 临时表空间:create temporary tablespace [临时表空间_TEMP] tempfile '/opt/oracle/oradata/[存放表空间和临时表空间dbf文件夹]/[临时表空间_TEMP].dbf' size 4096m  extent management local;

create temporary tablespace XXX_TEMP tempfile '/opt/oracle/oradata/XXX/XXX_TEMP.dbf' size 4096m  extent management local;


3.创建XXX用户:create user [用户] identified by [密码]  default tablespace [表空间_DATA] temporary tablespace [临时表空间_TEMP];

create user XXX  identified by pwdxxx  default tablespace XXX_DATA temporary tablespace XXX_TEMP;


4.赋角色:grant dba,resource,connect to [用户];

grant dba,resource,connect to XXX;

5.oracle启停操作

1.切换Oracle:su - oracle
2.起侦听:lsnrctl start(关闭将start切换为stop)
3.起实例:
sqlplus /nolog
conn / as sysdba;
startup;
4.关闭:
su - oracle
lsnrctl stop

上一篇:JAVA中CountDownLatch使用方法