在日常工作中如果遇到密码含有特殊字符的情况,使用sqlplus,expdp等工具进行登陆时可能会遇到各种麻烦。
比如下面的:
SQL> alter user user1 identified by "a@(^_^)p!";
User altered.
SQL> exit
oracle@lzstix0itest12:~> sqlplus user1/"a@(^_^)p!"
-bash: !": event not found
SQL> conn user1/"a@(^_^)p!"
ERROR:
ORA-12560: TNS:protocol adapter error
下面记录下解决办法,以备不时之需
1.如果客户端是Linux或Unix平台,则可以采用下面的方法,用单引号将用户名和密码括起来
oracle@testtest12:~> sqlplus 'user1/"a@(^_^)p!"'@test
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
2. 如果客户端是 Windows 平台,则可以采用下面的方法,在密码的前后加3个“双引号
C:\Users>sqlplus user1/"""a@(^_^)p!"""@test
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
比如下面的:
SQL> alter user user1 identified by "a@(^_^)p!";
User altered.
SQL> exit
oracle@lzstix0itest12:~> sqlplus user1/"a@(^_^)p!"
-bash: !": event not found
SQL> conn user1/"a@(^_^)p!"
ERROR:
ORA-12560: TNS:protocol adapter error
下面记录下解决办法,以备不时之需
1.如果客户端是Linux或Unix平台,则可以采用下面的方法,用单引号将用户名和密码括起来
oracle@testtest12:~> sqlplus 'user1/"a@(^_^)p!"'@test
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
2. 如果客户端是 Windows 平台,则可以采用下面的方法,在密码的前后加3个“双引号
C:\Users>sqlplus user1/"""a@(^_^)p!"""@test
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26753337/viewspace-2131808/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26753337/viewspace-2131808/