创建用户和表空间:
1、登录linux,以oracle用户登录(如果是root用户登录的,登录后用 su - oracle命令切换成oracle用户)
2、打开sqlplus,命令如下: sqlplus / as sysdba
[oracle@gaolong ~]$ sqlplus / as sysdba
3、创建临时表空间:
Sql代码
--查询临时表空间文件的绝对路径。如果需要的话,可以通过查询来写定绝对路径。一般用${ORACLE_HOME}就可以了
SQL> select name from v$tempfile;
SQL> create temporary tablespace TEST_TEMP tempfile '${ORACLE_HOME}\oradata\TEST_TEMP.bdf' size 100m reuse autoextend on next 20m maxsize unlimited;
4、创建表空间:
Sql代码
--查询用户表空间文件的绝对路径:
SQL> select name from v$datafile;
SQL> create tablespace TEST datafile '${ORACLE_HOME}\oradata\test.dbf' size 100M reuse autoextend on next 40M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);
5、创建用户和密码,指定上边创建的临时表空间和表空间
Sql代码
SQL> create user test identified by test123 default tablespace TEST temporary tablespace TEST_TEMP;
6、授权限
Sql代码
SQL> grant dba to test;
grant connect,resource to test;
grant select any table to test;
grant delete any table to test;
grant update any table to test;
grant insert any table to test;
7、退出当前实例
Sql代码
SQL> exit
8、使用新建的实例登录
Sql代码
[oracle@gaolong ~]$ sqlplus test/test123