---
title: "通过shell脚本后台创建表空间"
author: "wanglihu"
date: "2009-05-10T20:16:22Z"
tags: []
slug: "shell"
draft: false
lastmod: "2009-05-10T20:16:22Z"
id: 383033
url: "https://wanglihu.iteye.com/blog/383033"
---

1.用oracle用户登陆并创建shell文件：
$ vi /u01/app/shell.sh
并添加如下内容
sqlplus system/oracle_manager<<EOF
spool a.log
create tablespace test
    datafile 'oracle/fyweb/oradata/test1.dbf' size 10240M;
    spool off
EOF
2.后台执行：
$ cd /u01/app
$ ./shell.sh &