PLSQL Developer 12.0.7连接Oracle12c数据库


Windows下使用PL/SQL Developer 12.0.7连接Oracle12c数据库

1.下载安装PL/SQL Developer

下载PL/SQL Developer - Registered Download,这里选择当前最新版12.0.7x64位plsqldev1207x64.msi
双击plsqldev1207x64.msi进行安装,注册码参见PLSQL Developer 12.0.7 64位 注册码,设置如下:

product code: 4vkjwhfeh3ufnqnmpr9brvcuyujrx3n3le
serial Number:226959
password: xs374ca

2.下载Oracle Instant Client

PL/SQL Developer使用配合Oracle Instant Client

下载Oracle Instant Client,这里选择Instant Client for Microsoft Windows (x64),版本Version 12.2.0.1.0,选择instantclient-basic-windows.x64-12.2.0.1.0.zip

Version 12.2.0.1.0的Oracle数据库安装可参见Linux命令行安装Oracle12c

将下载的instantclient-basic-windows.x64-12.2.0.1.0.zip解压到和PL/SQL Developer安装的同级目录下(也可以是别的目录,看个人需要)
放在同级目录下

3.配置PL/SQL Developer首选项

①打开PLSQL Developer,登录界面如下,点击Cancel取消按钮
PL/SQL Developer 12.0.7登录界面

②点击菜单栏右上角按钮,或选择Configure-Preferences
点击或选择Configure-Preferences

③打开的Preferences窗口中,配置Oracle Home路径为Oracle Instant Client解压安装路径
下次启动PL/SQL生效
OCI library为Oracle Instant Client解压安装路径下的oci.dll文件
配置OracleHome
点击Apply-点击OK,使配置生效

④关闭PLSQL Developer,重新打开,多出了Connect as选项
配置了Oracle Instant Client后的显示

4.配置Oracle Instant Client

PLSQL Developer的登录界面没有数据库的初始化内容

在Oracle Instant Client解压安装目录下\NETWORK\ADMIN新建tnsnames.ora文件,instantclient_12_2下没有NETWORK\ADMIN目录,也要新建
配置tnsnames.ora

tnsnames.ora内容如下:

cdb1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Oracle服务IP)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = cdb1)
    )
  )

Oracle服务IP替换为Oracle的IP地址,配置完成后,关闭PLSQL Developer,重新启动

5.PL/SQL Developer登录Oracle

启动PLSQL Developer后出现的登录界面如下
配置完成tnsnames.ora后显示

这时如果不知道用哪个用户名登录,可以使用命令行语句查看oracle所有的用户,以及该用户的状态
select username,account_status from dba_users;

[oracle@solang ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon May 28 15:28:45 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> col username for a25
SQL> col account_status for a25
SQL> select username,account_status from dba_users;

USERNAME		  ACCOUNT_STATUS
------------------------- -------------------------
SYS			  OPEN
SYSTEM			  OPEN
XS$NULL 		  EXPIRED & LOCKED
OJVMSYS 		  EXPIRED & LOCKED
LBACSYS 		  EXPIRED & LOCKED
OUTLN			  EXPIRED & LOCKED
SYS$UMF 		  EXPIRED & LOCKED
DBSNMP			  EXPIRED & LOCKED
APPQOSSYS		  EXPIRED & LOCKED
DBSFWUSER		  EXPIRED & LOCKED
GGSYS			  EXPIRED & LOCKED

USERNAME		  ACCOUNT_STATUS
------------------------- -------------------------
ANONYMOUS		  EXPIRED & LOCKED
CTXSYS			  EXPIRED & LOCKED
SI_INFORMTN_SCHEMA	  EXPIRED & LOCKED
DVSYS			  EXPIRED & LOCKED
DVF			  EXPIRED & LOCKED
GSMADMIN_INTERNAL	  EXPIRED & LOCKED
ORDPLUGINS		  EXPIRED & LOCKED
MDSYS			  EXPIRED & LOCKED
OLAPSYS 		  EXPIRED & LOCKED
ORDDATA 		  EXPIRED & LOCKED
XDB			  EXPIRED & LOCKED

USERNAME		  ACCOUNT_STATUS
------------------------- -------------------------
WMSYS			  EXPIRED & LOCKED
ORDSYS			  EXPIRED & LOCKED
GSMCATUSER		  EXPIRED & LOCKED
MDDATA			  EXPIRED & LOCKED
SYSBACKUP		  EXPIRED & LOCKED
REMOTE_SCHEDULER_AGENT	  EXPIRED & LOCKED
GSMUSER 		  EXPIRED & LOCKED
SYSRAC			  EXPIRED & LOCKED
AUDSYS			  EXPIRED & LOCKED
DIP			  EXPIRED & LOCKED

USERNAME		  ACCOUNT_STATUS
------------------------- -------------------------
SYSKM			  EXPIRED & LOCKED
ORACLE_OCM		  EXPIRED & LOCKED
SYSDG			  EXPIRED & LOCKED
SPATIAL_CSW_ADMIN_USR	  EXPIRED & LOCKED

36 rows selected.

SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

用户状态为OPEN的用户为SYSSYSTEM,其中SYS为超级管理员用户
用户SYSSYSTEM的密码为数据库创建时的密码

忘记密码可进行修改

[oracle@solang ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon May 28 15:28:45 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> alter user you_username identified by you_password;

alter user system identified by OraPasswd1;

system用户输入用户名和密码,数据库为cdb1,Normal方式连接
system用户登录
sys用户输入用户名和密码,数据库为cdb1,SYSDBA或SYSOPER方式连接
sys用户登录

6.PL/SQL Developer显示SQL行号

点击菜单栏右上角按钮,或选择Configure-Preferences,左侧找到SQL Window,右侧找到Show gutter(line numbers)并勾选,Apply然后点击OK
PLSQLDeveloper显示SQL行号

7.PL/SQL Developer中文乱码处理

PLSQL执行SQL中文乱码

①查看数据库字符集
select userenv('language') from dual;
查看数据库字符集
字符集为AMERICAN_AMERICA.AL32UTF8

②查看本地字符集
select * from V$NLS_PARAMETERS;
查看本地字符集
发现第一行和第九行是相对应的,AMERICAN_AMERICA.AL32UTF8

③新建系统环境变量NLS_LANG
变量值和数据库的字符集相同,若已存在系统变量NLS_LANG,则更新变量值
新建系统环境变量
不新建到系统变量里,新建到上面的用户变量里也能正常使用。

④重新打开PL/SQL Developer
乱码问题已解决

8.PL/SQL Developer删除登录记录

最近登录过的用户记录会在打开PL/SQL Developer中显示
最近登录历史记录
打开Preferences窗口,选择Logon History,删除不常使用到的用户
删除PLSQL登录历史记录

9.PL/SQL Developer中文语言包

将下载安装的PL/SQL Developer汉化成中文。

下载PLSQL Developer 12中文汉化包Chinese.langPLSQL Developer 12中文语言包
将Chinese.lang中文语言包放入到PLSQL Developer安装目录下
Chinese.lang放入PLSQL安装目录
打开PL/SQL Developer,选择Preferences-Appearance-Language,选择Chinese.lang中文汉化包,点击Apply
选择中文汉化语言包
显示为中文
显示为中文

10.PL/SQL Developer命令行窗口

有些语句在SQL窗口执行不了,可以新建命令窗口执行。
新建命令窗口

本文参考:
PL/SQL Developer连接到Oracle 12c
PLSQL Developer 12.0.7 64位 注册码
plsql中文乱码问题(显示问号)

©️2020 CSDN 皮肤主题: 创作都市 设计师:CSDN官方博客 返回首页