centos8 安装Docker
1、安装依赖
# 首先我们设置 Docker 仓库
yum install -y yum-utils device-mapper-persistent-data lvm2
# 设置稳定的仓库 使用使用的是清华大学开源镜像站
cd /etc/yum.repos.d/
rm -f CentOS-Base.repo CentOS-AppStream.repo CentOS-PowerTools.repo CentOS-centosplus.repo CentOS-Extras.repo
curl -o CentOS-Base.repo https://raw.githubusercontent.com/hackyoMa/docker-centos/8/CentOS-Base.repo
yum makecache
# CentOS 8 必须安装以下依赖,否则会报错
# 没有翻墙的话可能比较慢,耐心等待
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
2、安装 Docker
yum install docker-ce
# 失败就按照提示清理缓存,再重新执行安装,第二次在上一次的基础上重新下载,多几次就行了。
下载的软件包保存在缓存中,直到下次成功执行事务。
您可以通过执行 'dnf clean packages' 删除软件包缓存。
错误:下载软件包出错
Cannot download Packages/docker-ce-19.03.8-3.el7.x86_64.rpm: All mirrors were tried
# 清理缓存
dnf clean packages
# 接着安装
yum install docker-ce
# 安装成功后进行确认
docker --version
Docker version 19.03.8, build afacb8b
启动 docker
systemctl start docker
设置开机启动
systemctl enable docker
安装 docker-compose
# 例如获取docker-compose-1.25.0版本命令(github):
curl -L https://github.com/docker/compose/releases/download/1.25.0-rc1/docker-compose-uname -s
-uname -m
-o /usr/local/bin/docker-compose
# 国内镜像
curl -L https://get.daocloud.io/docker/compose/releases/download/v1.25.2/docker-compose-uname -s
-uname -m
> /usr/local/bin/docker-compose
# 安装后赋权
chmod +x /usr/local/bin/docker-compose
# 安装成功后确认
docker-compose --version
docker-compose version 1.25.2, build 698e2846
配置国内镜像
# 创建或者修改 /etc/docker/daemon.json
vi /etc/docker/daemon.json
# 选择任意一个镜像地址即可
#Docker中国官方镜像加速
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
# 网易163镜像加速
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
# 中科大镜像加速
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
Docker 的常用命令
镜像命令
docker pull images-name
获取镜像docker images
查看所有镜像docker rmi image-id
删除镜像docker commit -m="description about images" --author="author" {container_id} {repository/images_name:tag}
保存镜像
容器命令
docker start 容器id
启动容器docker stop 容器id
停止容器docker exec -it 容器id /bin/bash
进入容器docker cp 宿主机绝对路径 容器id:路径
宿主机和 docker 容器之间复制文件
Docker 安装 MySQL
# 1、启动docker
service docker start
# 2、搜索mysql
docker search mysql
# 3、安装mysql
docker pull mysql:5.7
5.7: Pulling from library/mysql
68ced04f60ab: Pull complete
f9748e016a5c: Pull complete
da54b038fed1: Pull complete
6895ec5eb2c0: Pull complete
111ba0647b87: Pull complete
c1dce60f2f1a: Pull complete
702ec598d0af: Pull complete
63cca87a5d4d: Pull complete
ec05b7b1c5c7: Pull complete
834b1d9f49b0: Pull complete
8ded6a30c87c: Pull complete
Digest: sha256:f4a5f5be3d94b4f4d3aef00fbc276ce7c08e62f2e1f28867d930deb73a314c58
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
# 运行 mysql5.7
docker run --name mysql -p 3306:3306 --privileged=true -v /usr/local/docker/mysql/logs:/logs -v /usr/local/docker/mysql/data:/var/lib/mysql -v /etc/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
--privileged=true 获取临时的selinux的权限
-v 宿主机目录挂在到容器的地址,映射
-e MYSQL_ROOT_PASSWORD 初始化密码
启动 docker
- service docker start
搜索并安装 mysql
docker search mysql
3、安装mysql
docker pull mysql:5.7
5.7: Pulling from library/mysql
68ced04f60ab: Pull complete
f9748e016a5c: Pull complete
da54b038fed1: Pull complete
6895ec5eb2c0: Pull complete
111ba0647b87: Pull complete
c1dce60f2f1a: Pull complete
702ec598d0af: Pull complete
63cca87a5d4d: Pull complete
ec05b7b1c5c7: Pull complete
834b1d9f49b0: Pull complete
8ded6a30c87c: Pull complete
Digest: sha256:f4a5f5be3d94b4f4d3aef00fbc276ce7c08e62f2e1f28867d930deb73a314c58
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
配置编码
[mysql]
设置mysql客户端默认字符集
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock[mysqld]
mysql5.7以后的不兼容问题处理
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sockDisabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
Settings user and group are ignored when systemd is used.
If you need to run mysqld under a different user or group,
customize your systemd unit file for mariadb according to the
instructions in http://fedoraproject.org/wiki/Systemd
允许最大连接数
max_connections=200
服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_names=1
max_allowed_packet=16M设置时区
default-time_zone='+8:00'
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid#
include all files from the config directory
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/启动 mysql
docker run --name mysql -p 3306:3306 --privileged=true -v /usr/local/docker/mysql/logs:/logs -v /usr/local/docker/mysql/data:/var/lib/mysql -v /etc/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
--privileged=true 获取临时的selinux的权限
-v 宿主机目录挂在到容器的地址,映射
-e MYSQL_ROOT_PASSWORD 初始化密码
--name:容器名
--p:映射宿主主机端口
-v:挂载宿主目录到容器目录
-e:设置环境变量,MYSQL_ROOT_PASSWORD 初始化密码,此处指定root密码
-d:后台运行容器[root@yanglg docker]# docker run --name mysql -p 3306:3306 --privileged=true -v /usr/local/docker/mysql/logs:/logs -v /usr/local/docker/mysql/data:/var/lib/mysql -v /etc/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
165f2e22c403e9e572a80c937dec6b31b19c5691c25194537bae14d460becf9d操作 mysql
查看进程
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
165f2e22c403 mysql:5.7 "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql启动mysql
docker exec -it 165f2e22c403 /bin/sh
登录
mysql -u root -p
授权:
mysql> GRANT ALL ON . TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)更新加密规则:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)更新root用户
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)查看授权
mysql> select host,user,plugin,authentication_string from mysql.user;
#
mysql> SHOW VARIABLES LIKE 'characterset%';
安装oracle
下载安装
获取 oracle11g
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
Using default tag: latest
latest: Pulling from helowin/oracle_11g
ed5542b8e0e1: Pulling fs layer
a3ed95caeb02: Pulling fs layer
ed5542b8e0e1: Pull complete
a3ed95caeb02: Pull complete
1e8f80d0799e: Pull complete
Digest: sha256:4c12b98372dfcbaafcd9564a37c8d91456090a5c6fb07a4ec18270c9d9ef9726
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest
registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g:latest启动oracle
docker run -p 1521:1521 --name oracle11g -d registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
查看进程
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ac184622d55 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g "/bin/sh -c '/home/o…" 55 seconds ago Up 23 seconds 0.0.0.0:1521->1521/tcp oracle11g
165f2e22c403 mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql运行并进入容器
docker exec -it 7ac184622d55 bash
切换到root用户下
[oracle@7ac184622d55 /]$ su
Password: # 默认密码为 helowin
[root@7ac184622d55 /]#编辑环境变量 vi /etc/profile 在文件的末尾添加一下内容
vi /etc/profile
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH使配置生效
source /etc/profile
使用 exit 命令退出docker的oracle容器
查看进程
[root@yanglg ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ac184622d55 registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g "/bin/sh -c '/home/o…" 26 minutes ago Up 26 minutes 0.0.0.0:1521->1521/tcp oracle11g
165f2e22c403 mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql进入 oracle容器
[root@yanglg ~]# docker exec -it 7ac184622d55 /bin/bash
刷新配置
[oracle@7ac184622d55 /]$ source ~/.bash_profile
连接oracle
[oracle@7ac184622d55 /]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sat Mar 28 20:59:31 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.修改 system的密码
SQL> alter user system identified by root;
User altered.
修改sys密码
SQL> alter user sys identified by root;
User altered.
切换用户到system
SQL> conn system/root
Connected.查看实例名
SQL> select instance from v$thread;
INSTANCE
helowin
使用plsql 连接数据库
数据库的填写信息为 ip:1521/helowin
如 192.168.1.130:1521/helowin
修改实例名
1、 进入 oracle 容器
docker exec -it oracle11g bash
2、连接 oracle
[oracle@7ac184622d55 /]$ source ~/.bash_profile
[oracle@7ac184622d55 /]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 29 08:22:08 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba;
Connected.
3、查看实例名
QL> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
helowin
4、关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
# 退出oracle
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
5、修改/etc/oratab 文件
[oracle@7ac184622d55 /]$ vi /etc/oratab
# /etc/oratab 内容, 将 helowin 修改为 orcl
helowin:/home/oracle/app/oracle/product/11.2.0/dbhome_2:Y
# 修改后的内容为
orcl/home/oracle/app/oracle/product/11.2.0/dbhome_2:Y
6、修改.bash_profile 文件,将修改 ORACLE_SID 的修改为 orcl
[oracle@7ac184622d55 /]$ vi ~/.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_BASE=/home/oracle/app/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_2;export ORACLE_HOME
ORACLE_SID=helowin;export ORACLE_SID
ORACLE_TERM=xterm;export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH
# 使配置文件生效
[oracle@7ac184622d55 /]$ source ~/.bash_profile
# 查看环境变量进行确认
[oracle@7ac184622d55 /]$ env|grep ORACLE
ORACLE_SID=orcl
ORACLE_BASE=/home/oracle/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
7、修改 dbs 目录下的文件名
dbs 目录是用于存放数据库服务器端的参数文件 Spfile、初始化文件 init、还有密码文件 orapw O R A C L E S I D 在 ORACLE_SID 在 ORACLESID 在 ORACLE_HOME 目录下
# 进入到 $ORACLE_HOME/dbs并对hc_helowin.dat, lkHELOWIN spfilehelowin.ora 进行重名名
[oracle@7ac184622d55 /]$ cd $ORACLE_HOME/dbs
[oracle@7ac184622d55 dbs]$ ll
total 32
-rw-r-----. 1 oracle oinstall 3584 Jan 4 2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Mar 29 08:25 hc_helowin.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16 2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan 4 2016 inithelowin.ora
-rw-r-----. 1 oracle oinstall 24 Aug 23 2014 lkHELOWIN
-rw-r-----. 1 oracle oinstall 24 Dec 29 2015 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Mar 28 21:01 orapwhelowin
-rw-r-----. 1 oracle oinstall 3584 Mar 28 20:31 spfilehelowin.ora
[oracle@7ac184622d55 dbs]$ mv hc_helowin.dat hc_orcl.dat
[oracle@7ac184622d55 dbs]$ mv lkHELOWIN lkORCL
[oracle@7ac184622d55 dbs]$ mv spfilehelowin.ora spfileorcl.ora
[oracle@7ac184622d55 dbs]$ ll
total 28
-rw-r-----. 1 oracle oinstall 3584 Jan 4 2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Mar 29 08:25 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16 2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan 4 2016 inithelowin.ora
-rw-r-----. 1 oracle oinstall 24 Aug 23 2014 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Mar 28 21:01 orapwhelowin
-rw-r-----. 1 oracle oinstall 3584 Mar 28 20:31 spfileorcl.ora
# 重新生成密码文件,并将旧的密码文件删除
[oracle@7ac184622d55 dbs]$ orapwd file=$ORACLE_HOME/dbs/oraw$ORACLE_SID password=root entries=5 force=y
[oracle@7ac184622d55 dbs]$ ll
total 32
-rw-r-----. 1 oracle oinstall 3584 Jan 4 2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Mar 29 08:25 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16 2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan 4 2016 inithelowin.ora
-rw-r-----. 1 oracle oinstall 24 Aug 23 2014 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Mar 28 21:01 orapwhelowin
-rw-r-----. 1 oracle oinstall 2048 Mar 29 08:50 oraworcl
-rw-r-----. 1 oracle oinstall 3584 Mar 28 20:31 spfileorcl.ora
[oracle@7ac184622d55 dbs]$ rm -rf orapwhelowin
[oracle@7ac184622d55 dbs]$ ll
total 28
-rw-r-----. 1 oracle oinstall 3584 Jan 4 2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Mar 29 08:25 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16 2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan 4 2016 inithelowin.ora
-rw-r-----. 1 oracle oinstall 24 Aug 23 2014 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Mar 29 08:50 oraworcl
-rw-r-----. 1 oracle oinstall 3584 Mar 28 20:31 spfileorcl.ora
8、登录启动数据库,查看实例名字
[oracle@7ac184622d55 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 29 08:55:20 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
Database opened.
SQL> select instance from v$thread;
INSTANCE
--------------------------------------------------------------------------------
orcl
9、备份控制文件,并关闭退出数据库
SQL> alter database backup controlfile to trace resetlogs;
Database altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
10、根据旧的控制文件生成修改更新控制文件
进入控制文件的备份目录,根据
alter_orcl.log
日志文件($ORACLE_BASE/diag/rdbms/原实例名/新实例名/trace)找到控制备份文件 oracle 的备份文件复制一份进行修改
[oracle@7ac184622d55 dbs]$ cd $ORACLE_BASE/diag/rdbms/helowin/orcl/trace
[oracle@7ac184622d55 trace]$ pwd
/home/oracle/app/oracle/diag/rdbms/helowin/orcl/trace
[oracle@7ac184622d55 trace]$ ls
alert_orcl.log orcl_j000_1142.trm orcl_mman_86.trm orcl_ora_1110.trm orcl_p001_115.trm orcl_vktm_1072.trm
orcl_ckpt_92.trc orcl_j000_205.trc orcl_mmon_1098.trc orcl_ora_258.trc orcl_p002_117.trc orcl_vktm_72.trc
orcl_ckpt_92.trm orcl_j000_205.trm orcl_mmon_1098.trm orcl_ora_258.trm orcl_p002_117.trm orcl_vktm_72.trm
orcl_dbrm_1080.trc orcl_j004_166.trc orcl_ora_1067.trc orcl_ora_53.trc orcl_p003_119.trc
orcl_dbrm_1080.trm orcl_j004_166.trm orcl_ora_1067.trm orcl_ora_53.trm orcl_p003_119.trm
orcl_dbrm_80.trc orcl_mman_1086.trc orcl_ora_111.trc orcl_p000_113.trc orcl_p004_121.trc
orcl_dbrm_80.trm orcl_mman_1086.trm orcl_ora_111.trm orcl_p000_113.trm orcl_p004_121.trm
orcl_j000_1142.trc orcl_mman_86.trc orcl_ora_1110.trc orcl_p001_115.trc orcl_vktm_1072.trc
# 进入alert_orcl.log 查找备份文件目录,
[oracle@7ac184622d55 trace]$ vi alert_orcl.log
# 在日志文件中找到如下记录
alter database backup controlfile to trace resetlogs
Backup controlfile written to trace file /home/oracle/app/oracle/diag/rdbms/helowin/orcl/trace/orcl_ora_1110.trc
# 复制并修改
[oracle@7ac184622d55 trace]$ cp /home/oracle/app/oracle/diag/rdbms/helowin/orcl/trace/orcl_ora_1110.trc orcl.sql
[oracle@7ac184622d55 trace]$ vi orcl.sql
orcl.sql 文件内容
[oracle@7ac184622d55 trace]$ vi orcl.sql
Trace file /home/oracle/app/oracle/diag/rdbms/helowin/orcl/trace/orcl_ora_1110.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_2
System name: Linux
Node name: 7ac184622d55
Release: 4.18.0-147.5.1.el8_1.x86_64
Version: #1 SMP Wed Feb 5 02:00:39 UTC 2020
Machine: x86_64
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 19
Unix process pid: 1110, image: oracle@7ac184622d55 (TNS V1-V3)
*** 2020-03-29 08:55:38.718
*** SESSION ID:(192.3) 2020-03-29 08:55:38.718
*** CLIENT ID:() 2020-03-29 08:55:38.718
*** SERVICE NAME:(SYS$USERS) 2020-03-29 08:55:38.718
*** MODULE NAME:(sqlplus@7ac184622d55 (TNS V1-V3)) 2020-03-29 08:55:38.718
*** ACTION NAME:() 2020-03-29 08:55:38.718
kwqmnich: current time:: 0: 55: 38: 0
kwqmnich: instance no 0 repartition flag 1
kwqmnich: initialized job cache structure
kwqinfy: Call kwqrNondurSubInstTsk
*** 2020-03-29 08:56:43.452
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="helowin"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "HELOWIN" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/home/oracle/app/oracle/oradata/helowin/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/home/oracle/app/oracle/oradata/helowin/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/home/oracle/app/oracle/oradata/helowin/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/home/oracle/app/oracle/oradata/helowin/system01.dbf',
'/home/oracle/app/oracle/oradata/helowin/sysaux01.dbf',
'/home/oracle/app/oracle/oradata/helowin/undotbs01.dbf',
'/home/oracle/app/oracle/oradata/helowin/users01.dbf',
'/home/oracle/app/oracle/oradata/helowin/example01.dbf'
CHARACTER SET AL32UTF8
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2020_03_29/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2020_03_29/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/home/oracle/app/oracle/oradata/helowin/temp01.dbf'
SIZE 30408704 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
*** 2020-03-29 08:56:55.655
Stopping background process QMNC
*** 2020-03-29 08:56:56.710
Stopping background process MMNL
*** 2020-03-29 08:56:57.734
Stopping background process MMON
*** 2020-03-29 08:56:58.813
Process OS id : 1142 alive after kill----------------------------------------
SO: 0xbf4dae60, type: 2, owner: (nil), flag: -/-/-/0x00 if: 0x3 c: 0x3
proc=0xbf4dae60, name=process, file=ksu.h LINE:11459, pg=0
(process) Oracle pid:21, ser:4, calls cur/top: 0xbf891e28/(nil)
flags : (0x0) -
flags2: (0x0), flags3: (0x0)
intr error: 1089, call error: 0, sess error: 0, txn error 1089
intr queue: 1089
ksudlp FALSE at location: 0
(post info) last post received: 1089 72 12
last post received-location: ksu.h LINE:12733 ID:ksusig
last process to post me: bf4d8de0 2 0
last post sent: 0 0 26
last post sent-location: ksa2.h LINE:282 ID:ksasnd
last process posted by me: bf4d0be0 1 6
(latch info) wait_event=0 bits=0
O/S info: user: oracle, term: UNKNOWN, ospid: 1142 (DEAD)
OSD pid info: Unix process pid: 1142, image: oracle@7ac184622d55 (J000)
Short stack dump: ORA-00072: process "Unix process pid: 1142, image: oracle@7ac184622d55 (J000)" is not active
Dump of memory from 0x00000000BF4B5318 to 0x00000000BF4B5520
0BF4B5310 00000000 00000000 [........]
0BF4B5320 00000000 00000000 00000000 00000000 [................]
Repeat 31 times
ksukia: Starting kill, flags = 1
ksukia: killed 1 out of 1 processes.
*** 2020-03-29 08:56:59.846
ksukia: Starting kill, flags = 1
ksukia: killed 0 out of 0 processes.
*** 2020-03-29 08:56:59.983 4132 krsh.c
ARCH: Archival disabled due to shutdown: 1089
*** 2020-03-29 08:57:00.999
*** 2020-03-29 08:57:00.999 4132 krsh.c
ARCH: Archival disabled due to shutdown: 1089
修改文件内容
# :set number 或者 :set nu 是打开行数显示 :set nu! 关闭行数
# 1、删除 STARTUP NOMOUNT 之前的内容 /STARTUP NOMOUNT 查出位置 60dd 删除内容
# 2、删除 -- End of tempfile additions. 之后的内容 /End of tempfile 查出位置后删除
# 3、替换所有的helowin为orcl 命令 :%s/helowin/orcl/g
# 4、替换所有的HELOWIN为ORCL 命令 :%s/HELOWIN/ORCL/g
# 5、删掉以 -- 的行
# 6、 将CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG 中的 REUSE 改为 SET 变为了
# CREATE CONTROLFILE SET DATABASE "ORCL" RESETLOGS NOARCHIVELOG
# 7 将 RECOVER DATABASE USING BACKUP CONTROLFILE 注释掉改为 -- RECOVER DATABASE USING BACKUP CONTROLFILE
最终结果
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "ORCL" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/home/oracle/app/oracle/oradata/orcl/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/home/oracle/app/oracle/oradata/orcl/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/home/oracle/app/oracle/oradata/orcl/redo03.log' SIZE 50M BLOCKSIZE 512
DATAFILE
'/home/oracle/app/oracle/oradata/orcl/system01.dbf',
'/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf',
'/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf',
'/home/oracle/app/oracle/oradata/orcl/users01.dbf',
'/home/oracle/app/oracle/oradata/orcl/example01.dbf'
CHARACTER SET AL32UTF8
;
-- RECOVER DATABASE USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/home/oracle/app/oracle/oradata/orcl/temp01.dbf'
SIZE 30408704 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
# 生成配置文件
[oracle@7ac184622d55 trace]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 29 09:52:23 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile;
File created.
SQL> exit
Disconnected
# 最终生成的文件在$ORACLE_HOME/dbs目录下文件名为init$ORACLE_SID.ora
# 本实例名称为 initorcl.ora
[oracle@7ac184622d55 trace]$ ll $ORACLE_HOME/dbs
total 36
-rw-r-----. 1 oracle oinstall 3584 Jan 4 2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Mar 29 08:56 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16 2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan 4 2016 inithelowin.ora
-rw-r--r--. 1 oracle oinstall 1398 Mar 29 09:52 initorcl.ora
-rw-r-----. 1 oracle oinstall 24 Mar 29 08:55 lkHELOWIN
-rw-r-----. 1 oracle oinstall 24 Aug 23 2014 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Mar 29 08:50 oraworcl
-rw-r-----. 1 oracle oinstall 3584 Mar 29 08:55 spfileorcl.ora
# 目录文件修改
# initorcl.ora文件修改
# 1、 删除helowin. 开头的文件
# 2、 替换所有的helowin为orcl 命令 :%s/helowin/orcl/g
# 3、 替换所有的HELOWIN为ORCL 命令 :%s/HELOWIN/ORCL/g
[oracle@7ac184622d55 dbs]$ cd $ORACLE_HOME/dbs
修改前的文件你饿哦让
helowin.__db_cache_size=1191182336
orcl.__db_cache_size=1191182336
helowin.__java_pool_size=16777216
orcl.__java_pool_size=16777216
helowin.__large_pool_size=16777216
orcl.__large_pool_size=16777216
helowin.__oracle_base='/home/oracle/app/oracle'#ORACLE_BASE set from environment
orcl.__oracle_base='/home/oracle/app/oracle'#ORACLE_BASE set from environment
helowin.__pga_aggregate_target=1744830464
orcl.__pga_aggregate_target=1744830464
helowin.__sga_target=1610612736
orcl.__sga_target=1610612736
helowin.__shared_io_pool_size=0
orcl.__shared_io_pool_size=0
helowin.__shared_pool_size=369098752
orcl.__shared_pool_size=369098752
helowin.__streams_pool_size=0
orcl.__streams_pool_size=0
*.audit_file_dest='/home/oracle/app/oracle/admin/helowin/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/home/oracle/app/oracle/oradata/helowin/control01.ctl','/home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='helowin'
*.db_recovery_file_dest='/home/oracle/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/home/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=helowinXDB)'
*.local_listener='LISTENER_HELOWIN'
*.open_cursors=300
*.pga_aggregate_target=1741684736
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1610612736
*.undo_tablespace='UNDOTBS1'
自改后的文件内容
orcl.__db_cache_size=1191182336
orcl.__java_pool_size=16777216
orcl.__large_pool_size=16777216
orcl.__oracle_base='/home/oracle/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=1744830464
orcl.__sga_target=1610612736
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=369098752
orcl.__streams_pool_size=0
*.audit_file_dest='/home/oracle/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/home/oracle/app/oracle/oradata/orcl/control01.ctl','/home/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='/home/oracle/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/home/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.local_listener='LISTENER_ORCL'
*.open_cursors=300
*.pga_aggregate_target=1741684736
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1610612736
*.undo_tablespace='UNDOTBS1'
# 修改init.ora 文件
# 1、 替换所有的helowin为orcl 命令 :%s/helowin/orcl/g
# 2、 替换所有的HELOWIN为ORCL 命令 :%s/HELOWIN/ORCL/g
[oracle@7ac184622d55 dbs]$ vi init.ora
# 我的替换前和替换后一样,如果不一样就替换下
db_name='ORCL'
memory_target=1G
processes = 150
audit_file_dest='/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest=''
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (ora_control1, ora_control2)
compatible ='11.2.0'
# spfileisdms.ora文件修改
# 1、 删除helowin. 开头的文件
# 2、 替换所有的helowin为orcl 命令 :%s/helowin/orcl/g
# 3、 替换所有的HELOWIN为ORCL 命令 :%s/HELOWIN/ORCL/g
修改后的内容
orcl.__db_cache_size=1191182336
orcl.__java_pool_size=16777216
orcl.__large_pool_size=16777216
orcl.__oracle_base='/home/oracle/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=1744830464
orcl.__sga_target^AC^@^@C"^@^@^C^@^@^@^@^@^@^@^@^@^A^DKi^@^@=1610612736
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=369098752
orcl.__streams_pool_size=0
*.audit_file_dest='/home/oracle/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/home/oracle/app/oracle/oradata/orcl/control01.ctl','/home/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.^AC^@^@C"^@^@^D^@^@^@^@^@^@^@^@^@^A^D^^`^@^@db_name='orcl'
*.db_recovery_file_dest='/home/oracle/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest='/home/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.local_listener='LISTENER_ORCL'
*.open_cursors=300
*.open_cursors=300
*.pga_aggregate_target=1741684736
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1610612736
*.undo_tablespace='UNDOTBS1'
# 删除 lkHELOWIN 文件
[oracle@7ac184622d55 dbs]$ rm -rf lkHELOWIN
[oracle@7ac184622d55 dbs]$ ll
total 32
-rw-r-----. 1 oracle oinstall 3584 Jan 4 2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Mar 29 08:56 hc_orcl.dat
-rw-r--r--. 1 oracle oinstall 2851 Mar 29 10:16 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan 4 2016 inithelowin.ora
-rw-r--r--. 1 oracle oinstall 1022 Mar 29 10:11 initorcl.ora
-rw-r-----. 1 oracle oinstall 24 Aug 23 2014 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Mar 29 08:50 oraworcl
-rw-r-----. 1 oracle oinstall 3210 Mar 29 10:22 spfileorcl.ora
11、修改$ORACLE_BASE/admin 目录下的目录和文件内容
[oracle@7ac184622d55 dbs]$ cd $ORACLE_BASE/admin
[oracle@7ac184622d55 admin]$ ll
total 0
drwxr-x---. 1 oracle oinstall 19 Aug 23 2014 helowin
# 修改目录名
[oracle@7ac184622d55 admin]$ mv helowin orcl
# 修改$ORACLE_BASE/admin/orcl/pfile目录下文件
# 1、 替换所有的helowin为orcl 命令 :%s/helowin/orcl/g
# 2、 替换所有的HELOWIN为ORCL 命令 :%s/HELOWIN/ORCL/g
[oracle@7ac184622d55 admin]$ cd orcl/pfile/
[oracle@7ac184622d55 pfile]$ ll
total 4
-rw-r-----. 1 oracle oinstall 2223 Aug 23 2014 init.ora.72320146402
[oracle@7ac184622d55 pfile]$ vi init.ora.72320146402
12 修改$ORACLE_BASE/diag 目录下的目录和文件内容
[oracle@7ac184622d55 pfile]$ cd $ORACLE_BASE/diag
[oracle@7ac184622d55 diag]$ ll
total 0
drwxr-x---. 1 oracle oinstall 21 Jan 4 2016 rdbms
drwxr-xr-x. 1 oracle oinstall 26 Mar 28 20:31 tnslsnr
[oracle@7ac184622d55 diag]$ cd rdbms/
[oracle@7ac184622d55 rdbms]$ ll
total 0
drwxr-x---. 1 oracle oinstall 48 Dec 29 2015 helowin
# 修改名称
[oracle@7ac184622d55 rdbms]$ mv helowin orcl
[oracle@7ac184622d55 rdbms]$ cd orcl/
[oracle@7ac184622d55 orcl]$ ll
total 0
drwxr-xr-x. 13 oracle oinstall 148 Dec 29 2015 helowin
-rw-r-----. 1 oracle oinstall 0 Dec 29 2015 i_1.mif
drwxr-x---. 13 oracle oinstall 148 Aug 23 2014 orcl
# 删除helowin
[oracle@7ac184622d55 orcl]$ rm -rf helowin
[oracle@7ac184622d55 orcl]$ ll
total 0
-rw-r-----. 1 oracle oinstall 0 Dec 29 2015 i_1.mif
drwxr-x---. 13 oracle oinstall 148 Aug 23 2014 orcl
[oracle@7ac184622d55 orcl]$
13、修改$ORACLE_BASE/flash_recovery_area 目录下的目录和文件内容
[oracle@7ac184622d55 orcl]$ cd $ORACLE_BASE/flash_recovery_area
[oracle@7ac184622d55 flash_recovery_area]$ ll
total 0
drwxr-x---. 1 oracle oinstall 24 Jan 4 2016 HELOWIN
drwxr-x---. 1 oracle oinstall 27 Jan 4 2016 helowin
# 重命名
[oracle@7ac184622d55 flash_recovery_area]$ mv helowin orcl
[oracle@7ac184622d55 flash_recovery_area]$ mv HELOWIN ORCL
[oracle@7ac184622d55 flash_recovery_area]$ ll
total 0
drwxr-x---. 4 oracle oinstall 41 Jan 4 2016 ORCL
drwxr-x---. 2 oracle oinstall 52 Jan 4 2016 orcl
[oracle@7ac184622d55 flash_recovery_area]$ cd orcl/
[oracle@7ac184622d55 orcl]$ ll
total 19364
-rw-r-----. 1 oracle oinstall 10076160 Mar 29 08:56 control02.ctl
-rw-r-----. 1 oracle oinstall 9748480 Jan 4 2016 control02.ctl.bak
# 删除控制文件
[oracle@7ac184622d55 orcl]$ rm -rf control02.ctl
[oracle@7ac184622d55 orcl]$ ll
total 9520
-rw-r-----. 1 oracle oinstall 9748480 Jan 4 2016 control02.ctl.bak
14、修改$ORACLE_BASE/oradata 目录下的目录和文件
[oracle@7ac184622d55 orcl]$ cd $ORACLE_BASE/oradata
[oracle@7ac184622d55 oradata]$ ll
total 0
drwxr-x---. 2 oracle oinstall 225 Mar 28 20:31 helowin
[oracle@7ac184622d55 oradata]$ mv helowin orcl
[oracle@7ac184622d55 oradata]$ ll
total 0
drwxr-x---. 2 oracle oinstall 225 Mar 28 20:31 orcl
[oracle@7ac184622d55 oradata]$ cd orcl/
[oracle@7ac184622d55 orcl]$ ll
total 1626076
-rw-r-----. 1 oracle oinstall 10076160 Mar 29 08:56 control01.ctl
-rw-r-----. 1 oracle oinstall 9748480 Jan 4 2016 control01.ctl.bak
-rw-r-----. 1 oracle oinstall 104865792 Mar 29 08:56 example01.dbf
-rw-r-----. 1 oracle oinstall 52429312 Mar 29 08:55 redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Mar 29 08:56 redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Mar 29 08:55 redo03.log
-rw-r-----. 1 oracle oinstall 534781952 Mar 29 08:56 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 713039872 Mar 29 08:56 system01.dbf
-rw-r-----. 1 oracle oinstall 30416896 Mar 28 21:31 temp01.dbf
-rw-r-----. 1 oracle oinstall 99622912 Mar 29 08:56 undotbs01.dbf
-rw-r-----. 1 oracle oinstall 5251072 Mar 29 08:56 users01.dbf
[oracle@7ac184622d55 orcl]$ rm -rf control01.ctl
[oracle@7ac184622d55 orcl]$ ll
total 1616236
-rw-r-----. 1 oracle oinstall 9748480 Jan 4 2016 control01.ctl.bak
-rw-r-----. 1 oracle oinstall 104865792 Mar 29 08:56 example01.dbf
-rw-r-----. 1 oracle oinstall 52429312 Mar 29 08:55 redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Mar 29 08:56 redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Mar 29 08:55 redo03.log
-rw-r-----. 1 oracle oinstall 534781952 Mar 29 08:56 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 713039872 Mar 29 08:56 system01.dbf
-rw-r-----. 1 oracle oinstall 30416896 Mar 28 21:31 temp01.dbf
-rw-r-----. 1 oracle oinstall 99622912 Mar 29 08:56 undotbs01.dbf
-rw-r-----. 1 oracle oinstall 5251072 Mar 29 08:56 users01.dbf
15、 修改监听的配置文件 tnsnames.ora
[oracle@7ac184622d55 admin]$ cd $ORACLE_HOME/network/admin
[oracle@7ac184622d55 admin]$ ll
total 16
-rw-r--r--. 1 oracle oinstall 381 Dec 29 2015 listener.ora
drwxr-xr-x. 2 oracle oinstall 64 Aug 23 2014 samples
-rw-r--r--. 1 oracle oinstall 187 May 8 2007 shrept.lst
-rw-r--r--. 1 oracle oinstall 239 Aug 23 2014 sqlnet.ora
-rw-r-----. 1 oracle oinstall 425 Jan 4 2016 tnsnames.ora
[oracle@7ac184622d55 admin]$ vi tnsnames.ora
# 修改前的内容
LISTENER_HELOWIN =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
HELOWIN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = helowin)
)
)
# 修改后的内容
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
16、调用前面步骤修改好的 orcl.sql,目的是生成链接控制文件等
# 进入到 orcl.sql的目录中
[oracle@7ac184622d55 trace]$ cd $ORACLE_BASE/diag/rdbms/orcl/orcl/trace
[oracle@7ac184622d55 trace]$ ls
alert_orcl.log orcl_j000_1142.trc orcl_mman_86.trc orcl_ora_1110.trc orcl_p001_115.trc orcl_vktm_1072.trc
orcl.sql orcl_j000_1142.trm orcl_mman_86.trm orcl_ora_1110.trm orcl_p001_115.trm orcl_vktm_1072.trm
orcl_ckpt_92.trc orcl_j000_205.trc orcl_mmon_1098.trc orcl_ora_258.trc orcl_p002_117.trc orcl_vktm_72.trc
orcl_ckpt_92.trm orcl_j000_205.trm orcl_mmon_1098.trm orcl_ora_258.trm orcl_p002_117.trm orcl_vktm_72.trm
orcl_dbrm_1080.trc orcl_j004_166.trc orcl_ora_1067.trc orcl_ora_53.trc orcl_p003_119.trc
orcl_dbrm_1080.trm orcl_j004_166.trm orcl_ora_1067.trm orcl_ora_53.trm orcl_p003_119.trm
orcl_dbrm_80.trc orcl_mman_1086.trc orcl_ora_111.trc orcl_p000_113.trc orcl_p004_121.trc
orcl_dbrm_80.trm orcl_mman_1086.trm orcl_ora_111.trm orcl_p000_113.trm orcl_p004_121.trm
# 查看文件的绝对路径,为执行sql做准备
[oracle@7ac184622d55 trace]$ pwd
/home/oracle/app/oracle/diag/rdbms/orcl/orcl/trace
[oracle@7ac184622d55 trace]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 29 10:52:14 2020
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
# 执行修改好的sql,生成连接控制文件
SQL> @/home/oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl.sql
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Control file created.
Database altered.
Tablespace altered.
# 查看数据库运行状态 read_write为可读写模式
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
# 查看name 参数
SQL> show parameter name ;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string orcl
# 查看实例名
SQL> select name from v$database;
NAME
---------
ORCL
# 关闭
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
# 启动
SQL> startup
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
# 启动监听器
[oracle@7ac184622d55 trace]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 29-MAR-2020 13:49:01
Copyright (c) 1991, 2009, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
# TNS-01106: 表示监听已启动
注意点: orcl .sql 一定要保证正确,不然会导出错,导致启动有问题。