Oracle12C 基本操作和使用
上篇博客以及介绍了怎么安装Oracle,这篇博客介绍一下简单的使用
1.配置网络TNS,修改LINSTENER
vim /orcl/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.126.129)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
HOST后面那个改成具体的IP地址
2.启动监听
lsnrctl start
如果已经启动了,那就先关闭后再启动
lsnrctl stop
lsnrctl start
3.DBA登录
sqlplus / as sysdba
4.开启或关闭DB
startup
shutdown immediate
5.创建表空间
CREATE TABLESPACE ZJWTEST
LOGGING
DATAFILE '/home/oracle/tablespace/ZJWTEST.DBF'
SIZE 128M
AUTOEXTEND ON
NEXT 128M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
6.创建用户
如果没有创建容器的话,用户前面可以不加c##
CREATE USER c##zjw IDENTIFIED BY 123456
ACCOUNT UNLOCK
DEFAULT TABLESPACE ZJWTEST;
7.授权
GRANT CONNECT,RESOURCE TO c##zjw; --表示把 connect,resource权限授予新用户
GRANT DBA TO c##zjw; --表示把 dba权限授予给新用户(可选)