oracle 11g r2 操作系统认证登陆

1 查看os认证前缀

SQL> show parameter os_authent_prefix

2 创建oracle用户并授予权限

SQL> create user ops$test identified by externally;
SQL> grant connect to ops$test;
SQL> grant select any table to ops$test;
SQL> grant select any dictionary to ops$test;

3 创建操作系统用户,并设置密码

[oracle@orclserv1 ~]$ useradd -u 1001 test
-bash: /usr/sbin/useradd: Permission denied
[oracle@orclserv1 ~]$ exit
logout
[root@orclserv1 ~]# useradd -u 1001 test
[root@orclserv1 ~]# passwd test
Changing password for user test.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

4 进入oracle目录下bin目录运行sqlplus登陆数据库

[test@orclserv1 bin]$ pwd
/u01/app/oracle/product/11.2.0/db_1/bin
[test@orclserv1 bin]$ ./sqlplus /
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

5 这里需要设置用于环境变量,编辑test用户home目录下.bash_profile文件:

[test@orclserv1 ~]$ more .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1/
export ORACLE_SID=orcl11g
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH

6 登陆数据库,不需要输入用户名和密码:

[test@orclserv1 ~]$ sqlplus /

7 运行sql语句看一下效果:

SQL> l
  1* select owner, object_name, object_type from dba_objects where rownum<= 10
SQL> /

OWNER                          OBJECT_NAME                      OBJECT_TYPE
------------------------------ -------------------------------- -------------------
SYS                            ICOL$                            TABLE
SYS                            I_USER1                          INDEX
SYS                            CON$                             TABLE
SYS                            UNDO$                            TABLE
SYS                            C_COBJ#                          CLUSTER
SYS                            I_OBJ#                           INDEX
SYS                            PROXY_ROLE_DATA$                 TABLE
SYS                            I_IND1                           INDEX
SYS                            I_CDEF2                          INDEX
SYS                            I_OBJ5                           INDEX

10 rows selected.

猜你喜欢

转载自blog.csdn.net/lichx123/article/details/93377641
今日推荐