oracle 数据库挂载,一次Oracle数据库挂载迁移的过程记录

发布于:2021-10-19 12:03:28

设置ORACLE_HOME环境变量:export ORACLE_HOME=/oracle/product/11202


设置PATH环境变量:export PATH=$ORACLE_HOME/bin:$PATH


切换到lsnrctl目录:cd /oracle/product/11202/bin


1. linux下启动oracle


su - oracle


lsnrctl start


sqlplus /nolog


conn sys/oracle@gps as sysdba


startup


exit


exit


2. linux下关闭oracle


su - oracle


sqlplus /nolog


conn sys/oracle@gps as sysdba


shutdown immediate


exit


./lsnrctl stop


exit


启动和关闭的时候遇到两个问题的处理:


问题1:启动监听时提示“The listener supports no services”


原来listener.ora 如下:


LISTENER =


(DESCRIPTION_LIST =


(DESCRIPTION =


(ADDRESS = (PROTOCOL = TCP)(HOST = 10.2.1.185)(PORT = 1521))


(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))


)


)


需要添加以下内容:


SID_LIST_LISTENER =


(SID_LIST =


(SID_DESC =


(GLOBAL_DBNAME = orcl)


(SID_NAME = orcl)


)


)


/dev/mapper/vgdata-lvdata


1610113??? 127374?? 1400951?? 9% /data?????? 放置地图


/dev/mapper/VolGroup00-lvoradata


50397???? 17111???? 30727? 36% /oradata??? 原来GPS数据库放置文件的位置


/dev/mapper/VolGroup00-lvoracle


20159???? 14265????? 4870? 75% /oracle???? Oracle数据库安装的位置


/dev/mapper/VolGroup00-lvapp


20159?????? 421???? 18715?? 3% /app??????? 实用程序安装的位置


/dev/mapper/vgdata-lvdatafile


1548185?????? 386?? 1469157?? 1% /datafile?? 文件数据库放置位置


/dev/mapper/vgdata-lvoradata1


1651398???? 23552?? 1543961?? 2% /oradata1?? lvoradata1的临时挂载点


把将oradata挂载到lvoradata1的步骤:


1、停数据库,对数据库做备份,导出到其他服务器;


设置ORACLE_HOME环境变量:export ORACLE_HOME=/oracle/product/11202


设置PATH环境变量:export PATH=$ORACLE_HOME/bin:$PATH


切换到lsnrctl目录:cd /oracle/product/11202/bin


su - oracle


sqlplus /nolog


conn sys/oracle@gps as sysdba


shutdown immediate


exit


设置ORACLE_HOME环境变量:export ORACLE_HOME=/oracle/product/11202


设置PATH环境变量:export PATH=$ORACLE_HOME/bin:$PATH


切换到lsnrctl目录:cd /oracle/product/11202/bin


./lsnrctl stop


exit


cd /;


cd /oradata1;


rm -rf gisap;


rm -rf gps;


rm -rf lost+found;


rm -f test.trc;


rm -f full.log;


rm -f full.dpdmp;


cd /;


cd /oradata;


2、对/oradata目录做拷贝,将里面的数据复制到/oradata1目录下;


cp `ls -A` /oradata1 -r;


3、卸载两个目录,命令如下:


cd /


umount /oradata


umount /oradata1


4、挂载存储到/oradata下


mount /dev/vgdata/lvoradata1 /oradata


chmod -R 777 /oradata/gps


chmod -R 777 /oradata/gisap


5、启动数据库进行测试


设置ORACLE_HOME环境变量:export ORACLE_HOME=/oracle/product/11202


设置PATH环境变量:export PATH=$ORACLE_HOME/bin:$PATH


切换到lsnrctl目录:cd /oracle/product/11202/bin


su - oracle


lsnrctl start


sqlplus /nolog


conn sys/oracle@gps as sysdba startup exit exit

相关推荐

最新更新

猜你喜欢