误删除Oracle家目录的恢复方法

--创建oracle目录
[root@zw home]# mkdir oracle
[root@zw home]# ll
total 8
drwxr-xr-x 2 root   root 4096 Jan  7 21:22 oracle
drwx------ 3 oracle dba  4096 Jan  7 19:25 oracle.bak
[root@zw home]# chown -R oracle:dba oracle
[root@zw home]# ll
total 8
drwxr-xr-x 2 oracle dba 4096 Jan  7 21:22 oracle
drwx------ 3 oracle dba 4096 Jan  7 19:25 oracle.bak
[root@zw home]#
 
 
--复制骨架文件:
[root@zw home]# cp /etc/skel/.*  /home/oracle/
cp: omitting directory `/etc/skel/.'
cp: omitting directory `/etc/skel/..'
cp: omitting directory `/etc/skel/.mozilla'
[root@zw home]#
 
 
[root@dg1 home]# ls -la /home/oracle
[root@zw home]#  ls -la /home/oracle
total 28
drwxr-xr-x 2 oracle dba  4096 Jan  7 21:23 .
drwxr-xr-x 4 root   root 4096 Jan  7 21:22 ..
-rw-r--r-- 1 root   root   33 Jan  7 21:23 .bash_logout
-rw-r--r-- 1 root   root  176 Jan  7 21:23 .bash_profile
-rw-r--r-- 1 root   root  124 Jan  7 21:23 .bashrc
-rw-r--r-- 1 root   root  515 Jan  7 21:23 .emacs
 
[root@zw home]#  chown -R oracle:dba  /home/oracle
[root@zw home]# cd /home/oracle
[root@dg1 oracle]# ls -la
 
total 28
drwxr-xr-x 2 oracle dba  4096 Jan  7 21:23 .
drwxr-xr-x 4 root   root 4096 Jan  7 21:22 ..
-rw-r--r-- 1 oracle dba    33 Jan  7 21:23 .bash_logout
-rw-r--r-- 1 oracle dba   176 Jan  7 21:23 .bash_profile
-rw-r--r-- 1 oracle dba   124 Jan  7 21:23 .bashrc
-rw-r--r-- 1 oracle dba   515 Jan  7 21:23 .emacs
 
 
 
//修改oracle 用户的环境变量:
[root@zw oracle]# cat .bash_profile
# .bash_profile
 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
     . ~/.bashrc
fi
 
# User specific environment and startup programs
 
PATH=$PATH:$HOME/bin
export PATH
 
# Oracle Settings
# .bash_profile
 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
     . ~/.bashrc
fi
 
# User specific environment and startup programs
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/db_1
export ORACLE_SID=ogg02
#export NLS_LANG=american_america.zhs16gbk
#PATH=$PATH:$HOME/bin
alias  sqlplus="rlwrap sqlplus"
alias  rman="rlwrap rman"
export PATH=$ORACLE_HOME/bin:$PATH
export PATH
 
 
 [root@zw oracle]# . ./.bash_profile   --使文件生效
 
切换一下用户看有没有问题
[root@zw home]# cd oracle
 
[oracle@zw ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jan 7 21:31:28 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL>
 
恢复成功!
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值