Home Database Mysql Tutorial Oracle连接远程数据库配置介绍

Oracle连接远程数据库配置介绍

Jun 07, 2016 pm 05:22 PM

Oracle数据库的远程连接可以通过多种方式来实现,本文我们主要介绍四种远程连接的方法和注意事项,并通过示例来说明,接下来我们

Oracle数据库的远程连接可以通过多种方式来实现,本文我们主要介绍四种远程连接的方法和注意事项,并通过示例来说明,接下来我们就开始介绍。

第一种情况:

若oracle服务器装在本机上,那就不多说了,连接只是用户名和密码的问题了。不过要注意环境变量%ORACLE_HOME%/network/admin/是否设置。

第二种情况:

本机未安装oracle服务器,也未安装oracle客户端。但是安装了pl sql development、toad sql development、sql navigator等管理数据库的工具。在虚拟机或者另一台电脑上安装了oracle服务器,也就是虚拟机或者另一台电脑此时作为服务器。

这种情况下,本人以pl sql development远程连接ORACLE服务端数据库为例:

1、在安装oracle服务器的机器上搜索下列文件:

oci.dll

ocijdbc10.dll

ociw32.dll

orannzsbb10.dll

oraocci10.dll

oraociei10.dll

sqlnet.ora

tnsnames.ora

classes12.jar

ojdbc14.jar

把这些找到的文件复制放到一个文件夹,如 oraclient,将此文件夹复制到客户端机器上。如放置路径为 D:oraclient。

2、配置tnsnames.ora,修改其中的数据库连接串。

oracledata =  (DESCRIPTION =  (ADDRESS_LIST =  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.58)(PORT = 1521))    (CONNECT_DATA =  (SERVICE_NAME = oracledata)    )

其中,oracledata是要连接的服务名;HOST = 192.168.0.58,是服务器IP地址;PORT = 1521是端口号。

3、添加第一个环境变量,名为TNS_ADMIN,值为tnsnames.ora文件所在路径(如:D:oraclient,特别是重装后或其它操作,忘了TNS_ADMIN变量,plsql登陆就会报无法解析指定的连接标识符),这是为了能够找到上面说的tnsnames.ora。这步是最重要的。

添加第二个环境变量(可有可无):“NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK”,(AMERICAN_AMERICA.US7ASCII 是ASCII编码类型,其它类型可自己到服务器看一下或网上查找一下)(本步骤暂时要做对,如果编码不对,,会产生乱码)。

4、下载并安装PL SQL Developer配置应用:

打开PL SQL Developer,登入界面点取消,进入后选择菜单栏 tools->preferences->connection :

Oracle Home=D:oracleclient  OCI library=D:oracleclientoci.dll

5、再次打开plsql则会在database中有oracledata 选项输入用户名密码就可以登陆。

第三种情况:

本机未安装ORACLE服务器,但是安装了oracle客户端,也安装了pl sql development、toad sql development、sql navigator等管理数据库的工具。在虚拟机或者另一台电脑上安装了oracle服务器,也就是虚拟机或者另一台电脑此时作为服务器。

这种情况下,本人以pl sql development远程连接oracle服务端数据库为例:

1、打开oracle客户端中的net manager,配置要远程连接的数据库名、IP地址等,如果net manager中没有要远程连接的数据库名,则新建即可。

2、其他步骤与第二种情况中的2---5相同。

第四种情况:

本机未安装oracle服务器,也未安装pl sql development、toad sql development、sql navigator等管理数据库的工具,但是安装了oracle客户端。在虚拟机或者另一台电脑上安装了ORACLE服务器,也就是虚拟机或者另一台电脑此时作为服务器。

这种情况下,本人以oracle客户端中的sqlplus远程连接oracle服务端数据库为例:

1、打开oracle客户端中的net manager,配置要远程连接的数据库名、IP地址等,如果net manager中没有要远程连接的数据库名,则新建即可。

2、同第二种情况中的步骤二。

3、同第二种情况中的步骤三。

4、打开sqlplus:

(1)如果用sys用户登入,则用户名:sys 密码:xxxxxx 主机字符串:要连接的数据库名 as sysdba,登入即可。

(2)如果用其他用户登入,则用户名:xxx 密码:xxxxxx 主机字符串:要连接的数据库名,登入即可。

注意事项:

1、服务器端和客户端防火墙需要关闭;

2、我们经常会遇到***服务无法启动,那么需要打开Net Configuration Assistant修复,或者新建***服务。

3、数据库密码如果忘了怎么办?按照以下方法修改密码即可:

开始-->运行-->cmd

输入 :sqlplus /nolog 回车

输入 :connect / as sysdba 回车

用户解锁 : alter user system account unlock 回车

修改密码:alter user system identified by manager

4、怎样判断数据库是运行在归档模式下还是运行在非归档模式下?

进入dbastudio,历程--〉数据库---〉归档查看。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Reduce the use of MySQL memory in Docker Reduce the use of MySQL memory in Docker Mar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared library How to solve the problem of mysql cannot open shared library Mar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin) Run MySQl in Linux (with/without podman container with phpmyadmin) Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overview What is SQLite? Comprehensive overview Mar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guide Running multiple MySQL versions on MacOS: A step-by-step guide Mar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles