免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2205 | 回复: 12
打印 上一主题 下一主题

shell的问题? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-11 09:44 |只看该作者 |倒序浏览
我写一shell:
rq==date +"! %T %a %D"
export  rq
echo  $rq
#把当天日期赋予变量rq

#rm  -f  /home/oracle/product/8.17/lxy/backup/  

#清空 /backup目录
echo "----------------------------------------------------" >> /home/oracle/product/8.1.7/lxy/backup/oracle_log
echo   "Starting   Exp  Oracle : " >> /home/oracle/product/8.1.7/lxy/backup/oracle_log
su  -  oracle  -c   "exp  sys/sys  file=/home/oracle/product/8.1.7/lxy/backup/lxs.dmp   log=/home/oracle/product/8.1.7/lxy/backup/lxs.log   owner=lxs  " >> ./oracle_log1
      # /home/oracle/product/8.1.7/lxy/backup/oracle_log1

echo "Done."
#导出用户lxs的备份

cp   ./lxs*   /backup/ >> /home/oracle/product/8.1.7/lxy/backup/oracle_log
rm   -f  lxs*

其中这句话:
su  -  oracle  -c   "exp  sys/sys  file=/home/oracle/product/8.1.7/lxy/backup/lxs.dmp   log=/home/oracle/product/8.1.7/lxy/backup/lxs.log   owner=lxs  " >> ./oracle_log1
怎麽执行过程老是不能定向到oracle_log1文件中呀?那位给支支招

论坛徽章:
0
2 [报告]
发表于 2003-03-11 10:16 |只看该作者

shell的问题?

[root@test backup]# su - oracle -c "lsnrctl  status" >> ./log
[root@test backup]#
这命令就可以订到文件中,而这命令:
[root@test backup]# su  - oracle  -c "exp  sys/sys  file=lxs  log=lxs  owner=lxs " >> ./log

Export: Release 8.1.7.0.1 - Production on 星期二 3月 11 10:03:55 2003

(c) Copyright 2000 Oracle Corporation.  All rights reserved.


Connected to: Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production
With the Partitioning option
JServer Release 8.1.7.0.1 - Production
Export done in ZHS16CGB231280 character set and US7ASCII NCHAR character set

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user LXS
. exporting object type definitions for user LXS
About to export LXS's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export LXS's tables via Conventional Path ...
. . exporting table                          AGENT
导出命令就定不进去,怎回事呢?

论坛徽章:
0
3 [报告]
发表于 2003-03-11 11:07 |只看该作者

shell的问题?

try this:

su - oracle -c "exp sys/sys file=lxs log=lxs owner=lxs " >> ./log  2>&1

论坛徽章:
0
4 [报告]
发表于 2003-03-11 11:32 |只看该作者

shell的问题?

牛,真厉害,困扰我一天了,你能说说为什麽加“2>&1”是何意思,为什麽我在作别的定向时不加也可以进入文件,为什麽在这要加这个

论坛徽章:
0
5 [报告]
发表于 2003-03-11 12:00 |只看该作者

shell的问题?

2>&1
表示把错误输出重定向到标准输出(默认情况下)

你上面的那些信息是输出到错误输出(2)的
而>>./log只重定向了标准输出(1)
在这儿 2>&1 的作用是把错误输出(2)也重定向到log文件了

论坛徽章:
0
6 [报告]
发表于 2003-03-11 14:43 |只看该作者

shell的问题?

但是我的导出过程是没有错误的,也许exp的输出就是定向到错误输出中的

论坛徽章:
0
7 [报告]
发表于 2003-03-11 16:40 |只看该作者

shell的问题?

终于想通了,你

论坛徽章:
0
8 [报告]
发表于 2003-03-11 17:00 |只看该作者

shell的问题?

同则不同,同则不同

论坛徽章:
0
9 [报告]
发表于 2003-03-12 06:56 |只看该作者

shell的问题?

[quote]原帖由 "nkliyong"]同则不同,同则不同[/quote 发表:


什么玩意儿~~  :)

论坛徽章:
0
10 [报告]
发表于 2003-03-12 08:30 |只看该作者

shell的问题?

原帖由 "红袖添香" 发表:


什么玩意儿~~  :)


红袖姐这都没听说过啊
写的离红袖姐姐远点!·
————————————————





























那是狗屁
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP