Preface
Here are the detailed steps for graphically deploying Oracle Database 12C under Alibaba Cloud Linux CentOS7.7, which is suitable for beginners to learn and use. Friends who have just contacted Alibaba Cloud Server may be very confused when deploying Oracle database. I don’t know how to start. I will share with you the following deployment process. I hope it can help you deploy Oracle database on Alibaba Cloud. If there are deficiencies, please give more pointers in the comment area, thank you.
1. Environmental preparation
After real-name authentication, new users of Alibaba Cloud can try the cloud server for free for 1 month, and can receive a month of practice exercises.
1. Choose to try cloud server.
Log in to the homepage of Alibaba Cloud official website. In the trial center, you can choose a cloud server with 2 cores 4G trial for 7 days or 1 core 2G trial for 1 month. Here you can choose according to your needs. It is recommended to choose a high configuration.
2. Choose configuration.
After you click on the 0 yuan trial, the configuration options will appear. The operating system can choose according to your needs. The broadband can be adjusted to 5M. After the selection is completed, click Buy Now to start the trial.
3. Modify the cloud server password.
When using Alibaba Cloud server for the first time, you need to change the password. After logging in to the Alibaba Cloud homepage, click the console in the upper right corner, click Products and Services on the next page, and then click the cloud server ECS, then we will see the free cloud server Related Information.
Click the blue ID name to jump to the more detailed information of the cloud server. Click the more button on this page to select the reset instance password to modify the server password. After the modification is completed, you can use Xshell to connect remotely. The remote address is shown in the figure. The public network address, port is also the default 22, the administrator user defaults to root, and the password is the password you just modified.
Two, install the database dependency package
After using Xshell to connect remotely, first install the dependency packages needed for Oracle database installation. Alibaba Cloud server can connect to the public network, and the dependency packages can be downloaded and installed directly online, and execute the following commands.
yum -y install binutils compat-libcap1 gcc gcc-c++ glibc glibc-devel ksh libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
Three, modify the server name in the hosts file
1. Use the following command to view the name of the machine.
more /proc/sys/kernel/hostname
2. Switch to the /etc path to modify the content of the hosts file, first back up the file and then modify the content.
cd /etc
mv hosts hosts_bk
vi hosts
Add the following content, only keep the following content
127.0.0.1 机器名
After editing, press Esc and enter: wq to save and exit.
Fourth, set the swap partition space
The swap space is generally twice that of the memory. For example: 1G of memory can be set to 3G in size for the swap partition. The server swap partition space newly applied by Alibaba Cloud is 0 by default, and you need to set it manually.
1. Create a swap partition file.
dd if=/dev/zero of=/home/swapfile bs=10M count=1024
Explanation: bs is the size of each block, count is the number of blocks, bs * count is the size of the swap file, here 10M * 1024=10G, you can adjust it according to your needs, swapfile is the path of the swap file, you can modify it according to your needs. Put it directly under the /home path.
2. Format the swap partition file.
mkswap swapfile
3. Enable swap partition file.
swapon swapfile
4. Check the mounting situation.
free
5. Set to auto mount when booting.
Modify the file /etc/fstab and add /home/swapfile swap swap defaults 0 0.
vi /etc/fstab
/home/swapfile swap swap defaults 0 0
After editing, press Esc, enter: wq to save and exit, you can reboot to test.
Five, system related parameter modification
To modify the core parameters of the operating system, perform the following steps as the root user:
1. Modify the user's SHELL limit and modify the /etc/security/limits.conf file.
Enter the command: vi /etc/security/limits.conf Press the i key to enter the editing mode, and add the following content to the file.
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
After editing, press Esc and enter: wq to save and exit.
2. Modify the /etc/pam.d/login file and enter the command: vi /etc/pam.d/login Press the i key to enter the editing mode, and add the following content to the file.
session required /lib/security/pam_limits.so
session required pam_limits.so
After editing, press Esc and enter: wq to save and exit.
3. Modify the linux kernel, modify the /etc/sysctl.conf file, enter the command: vi /etc/sysctl.conf Press the i key to enter the editing mode, and add the following content to the file.
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 4090951690
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
After editing, press Esc and enter: wq to save and exit.
4. To make /etc/sysctl.conf change effective immediately, you need to execute the following command:
sysctl -p
5. Edit /etc/profile and enter the command: vi /etc/profile Press the i key to enter the editing mode, and add the following content to the file.
if [ $USER = "oracle" ];
then
if [ $SHELL = "/bin/ksh" ];
then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
After editing, press Esc and enter: wq to save and exit.
Six, create an Oracle user and configure related parameters
1. Use the root user to create related users and groups as the owner of the software installation and support group.
To create a user group, enter the command:
groupadd oinstall
groupadd dba
2. Use the root user to create an Oracle user and password, and enter the command:
useradd -g oinstall -g dba -m oracle
passwd oracle
Then you will be asked to enter the password. Enter the password twice at will, but it must be consistent. Press Enter to confirm.
3. Use the root user to create the database software directory and data file storage directory. The location of the directory is determined according to your own situation. Pay attention to the disk space. Here I put it under the Oracle user, for example:
input the command:
mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
4. Change the directory owner to be owned by the Oracle user, enter the command:
chown -R oracle:oinstall /home/oracle/app
chmod -R 755 /home/oracle/app/oracle
5. Configure the environment variables of the Oracle user. First, switch to the newly created Oracle user and enter:
su - oracle
Then enter: vi .bash_profile command, press i to edit .bash_profile, enter the editing mode, and add the following:
umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/12.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
After editing, press Esc and enter: wq to save and exit. When adding, note that the path corresponds to your own.
6. Execute the following command to make the environment variable take effect immediately.
source .bash_profile
Seven, turn on server graphics
1. Before installing the graphical interface, execute the following command to install X WINDOWS first. For this control function, enter y when prompted to confirm.
yum groupinstall "X Window System"
2. Execute the following command to install graphically, the installation time is a bit long, brush a vibrato and wait patiently.
yum groupinstall -y "GNOME Desktop"
8. Start the installation
1. Upload the installation package to the /home/oracle directory and decompress it. The installation file is a bit large and the upload is a bit slow. Continue to use the vibrato... The main introduction here is graphical installation.
cd /home/oracle
unzip linuxx64_12201_database.zip
2. Use Alibaba Cloud remote tool to remotely access the service desktop, use Oracle user login, or the previous screenshot, click the blue ID to enter the page below, note that there is a difference between the old version and the new version, click Remote Connection, and select on the pop-up page VNC remote connection, the first time you use it, you will be given a random password. Remember, enter the password to log in .
Log in as an Oracle user. If it is not a graphical interface when logging in here, you can use the root user to execute startx in Xshell to switch. Of course, you can also set to start graphically at boot time. I will explain more here.
4. Switch to the installation package path and execute the installation program file. After a while, the graphical installation interface will appear .
cd /home/oracle/database
./runInstaller
5. Installation diagram
Click YES in the pop-up window
Note here that the tick in the figure below means to create a data warehouse. It is not recommended for beginners to tick it. It will be more complicated to use after tick.
The setting password can be set separately or the same password can be used, and the next step can be skipped when the password is weak.