---
title: "Linux 连接Oracle数据库执行SQL"
author: "xuxujing"
date: "2013-07-31T14:56:51Z"
tags: []
categories: ["行业应用"]
slug: "linux-oracle-sql"
draft: false
lastmod: "2013-07-31T14:56:51Z"
id: 1916076
url: "https://xujava.iteye.com/blog/1916076"
---

连接Linux主机

\[root@m132 ~]#

 

切换用户

\[root@m132 ~]# su - oracle

 

解决中文乱码

\[oracle@m132 ~]$ export NLS\_LANG=AMERICAN\_AMERICA.ZHS16GBK

 

登录SqlPlus

\[oracle@m132 ~]$ sqlplus / as sysdba

 

SQL\*Plus: Release 11.2.0.1.0 Production on Wed Jul 31 09:12:10 2013

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Data Mining and Real Application Testing options

 

SQL&gt; 

 

执行SQL脚本，创建表空间，用户，分配权限。

SQL&gt; @@/oradata/wsp/wsp.sql;

 

Tablespace created.

 

 

User created.

 

 

Grant succeeded.

 

SQL&gt;