1.进入Oracle
su oracle
2.开启监听器
[oracle@localhost root]$ lsnrctl status
[oracle@localhost root]$ lsnrctl start
[oracle@localhost root]$ sqlplus / as sysdba
SQL> connect / as sysdba
SQL> startup
3.连接数据库
#1
[oracle@localhost root]$ sqlplus / as sysdba
SQL> select name from v$database
#2
[oracle@localhost root]$ sqlplus /nolog
SQL> select name from v$database;
SQL> connect system@prod
Enter password:
Connected.
3.关闭scott的账户锁(解锁)
#1
SQL> alter user scott account unlock;
User altered.
#2
SQL> alter user scott identified by tiger;
User altered.
4.创建用户并连接(没权限)
SQL> create user xtr identified by xtr;
User created.
SQL> connect xtr@prod
Enter password:
ERROR:
ORA-01045: user XTR lacks CREATE SESSION privilege; logon denied
Warning: You are no longer connected to ORACLE.
5.授权(需要先用system连接)
SQL> grant connect,resource,dba to xtr;
SP2-0640: Not connected
SQL> connect system@prod
Enter password:
Connected.
SQL> grant connect,resource,dba to xtr;
Grant succeeded.
6.连接
SQL> connect xtr@prod
Enter password:
Connected.
7.删除用户(cascade强制删除)
SQL> connect system@prod
Enter password:
Connected.
SQL> drop user xtr cascade;
User dropped.
8.创建表空间
SQL> create tablespace ts1 datafile '/oradata/ts1.dbf' size 50M;
Tablespace created.
9.修改kb22用户默认表空间为ts1文章来源:https://www.toymoban.com/news/detail-625994.html
SQL> xtr@prod
Enter password:
Connected.
SQL> alter database default tablespace ts1;
Database altered.
10.删除表空间文章来源地址https://www.toymoban.com/news/detail-625994.html
SQL> drop tablespace ts2 including contents and datafiles;
到了这里,关于Linux下的Oracle连接的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!