[英]How to automatically remount Azure Linux OS disk for read-write to enable Oracle DB auto-startup
I have a Linux VM in Azure, with Oracle Database installed. 我在Azure中安装了Linux VM,并安装了Oracle数据库。 In order to get the database up and running, I have to run the following commands in sequence: 为了启动和运行数据库,我必须依次运行以下命令:
sudo su -
followed by password entry (the user I have access to is not an admin user) sudo su -
输入密码(我有权访问的用户不是管理员用户) mount -orw,remount /; exit
sudo su - oracle
(password entry not required at this point) sudo su - oracle
(此时无需输入密码) lsnrctl start
sqlplus /nolog
CONNECT / AS SYSDBA;
STARTUP;
DISCONNECT;
CONNECT;
followed by entering user id/password 然后输入用户ID /密码 This makeshift routine is a result of my (probably) botching the OS disk expansion. 这个临时例程是我(可能)修改了OS磁盘扩展的结果。 While I somehow managed to successfully complete the disk expansion, the database became unable to start up automatically like it did before my disk expansion efforts. 尽管我设法成功完成了磁盘扩展,但数据库却无法像我进行磁盘扩展之前一样自动启动。
Ideally I would like to configure the database to startup automatically like before; 理想情况下,我想将数据库配置为像以前一样自动启动; failing which, any way to automate/shortcut this routine would be appreciated (I have this committed to muscle memory, but any amount of time saved would be great). 否则,将以任何方式使该例程自动化/捷径将不胜感激(我致力于肌肉记忆,但是节省的时间量将是巨大的)。
You could you a script to do all routine on startup. 您可以使用脚本在启动时执行所有例程。
Create script like this and call it startDB.sh (do not forget to make it executable - chmod +x startDB.sh): 像这样创建脚本并将其命名为startDB.sh(不要忘记使其可执行-chmod + x startDB.sh):
\#!/bin/sh
mount -orw,remount /; exit
lsnrctl start
sqlplus /nolog <<EOF
connect user/pass
STARTUP;
DISCONNECT;
EOF
Add script to startup: 将脚本添加到启动:
\#crontab -e
@reboot su - user -c "/home/user/startDB.sh"
If you don't have access to crontab, you can run startDB.sh script manually, this should help you to save some time :) 如果您无权访问crontab,则可以手动运行startDB.sh脚本,这应该可以帮助您节省一些时间:)
It's not tested, so there can be errors or mistypes, please run some test before using it in production. 它未经测试,因此可能存在错误或类型错误,请在生产中使用它之前进行一些测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.