Docker修改Oracle11g SID

[root@ecs ~]# docker ps
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED        STATUS        PORTS                                                  NAMES
4cf60f36ccfe   registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   47 hours ago   Up 21 hours   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp              oracle11g
5afac0f6ff6a   tomcat:8.5.38                                          "catalina.sh run"        2 days ago     Up 4 hours    0.0.0.0:80->80/tcp, :::80->80/tcp, 8080/tcp            zcpt
437caeb14725   mysql:5.7                                              "docker-entrypoint.s…"   12 days ago    Up 21 hours   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql
[root@ecs ~]# docker exec -it 4cf60f36ccfe /bin/bash
[oracle@4cf60f36ccfe /]$ su - oracle
Password:
[oracle@4cf60f36ccfe ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 10 12:27:09 2022

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> col host_name format a20
SQL> select host_name,instance_name,status from v$instance;

HOST_NAME            INSTANCE_NAME    STATUS
-------------------- ---------------- ------------
4cf60f36ccfe         helowin          OPEN

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
helowin

SQL> view plaincopyprint?
SP2-0734: unknown command beginning "view plain..." - rest of line ignored.
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
[oracle@4cf60f36ccfe ~]$ vi /etc/oratab
[oracle@4cf60f36ccfe ~]$ vi /etc/oratab
[oracle@4cf60f36ccfe ~]$ vi .bash_profile
[oracle@4cf60f36ccfe ~]$ .bash_profile
-bash: .bash_profile: command not found
[oracle@4cf60f36ccfe ~]$ vi .bash_profile
[oracle@4cf60f36ccfe ~]$ env |grep ORACLE
ORACLE_SID=helowin
ORACLE_BASE=/home/oracle/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
[oracle@4cf60f36ccfe ~]$ .bash_profile
-bash: .bash_profile: command not found
[oracle@4cf60f36ccfe ~]$ vi .bash_profile
[oracle@4cf60f36ccfe ~]$ source .bash_profile
[oracle@4cf60f36ccfe ~]$ 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
[oracle@4cf60f36ccfe ~]$ cd $ORACLE_HOME/dbs
[oracle@4cf60f36ccfe dbs]$ ll
total 32
-rw-r----- 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw---- 1 oracle oinstall 1544 Oct 10 12:28 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 Oct  8 15:28 orapwhelowin
-rw-r----- 1 oracle oinstall 3584 Oct 10 10:07 spfilehelowin.ora
[oracle@4cf60f36ccfe dbs]$ mv hc_helowin.dat hc_orcl.dat
[oracle@4cf60f36ccfe dbs]$ mv init
init.ora         inithelowin.ora
[oracle@4cf60f36ccfe dbs]$ ll
total 32
-rw-r----- 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw---- 1 oracle oinstall 1544 Oct 10 12:28 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 lkHELOWIN
-rw-r----- 1 oracle oinstall   24 Dec 29  2015 lkORCL
-rw-r----- 1 oracle oinstall 2048 Oct  8 15:28 orapwhelowin
-rw-r----- 1 oracle oinstall 3584 Oct 10 10:07 spfilehelowin.ora
[oracle@4cf60f36ccfe dbs]$ mv inithelowin.ora initorcl.ora
[oracle@4cf60f36ccfe dbs]$ ll
total 32
-rw-r----- 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw---- 1 oracle oinstall 1544 Oct 10 12:28 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 initorcl.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 Oct  8 15:28 orapwhelowin
-rw-r----- 1 oracle oinstall 3584 Oct 10 10:07 spfilehelowin.ora
[oracle@4cf60f36ccfe dbs]$ mv lkHELOWIN lkORCL
[oracle@4cf60f36ccfe dbs]$ LL
-bash: LL: command not found
[oracle@4cf60f36ccfe dbs]$ ll
total 28
-rw-r----- 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw---- 1 oracle oinstall 1544 Oct 10 12:28 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 initorcl.ora
-rw-r----- 1 oracle oinstall   24 Aug 23  2014 lkORCL
-rw-r----- 1 oracle oinstall 2048 Oct  8 15:28 orapwhelowin
-rw-r----- 1 oracle oinstall 3584 Oct 10 10:07 spfilehelowin.ora
[oracle@4cf60f36ccfe dbs]$ mv orapwhelowin orapworcl
[oracle@4cf60f36ccfe dbs]$ ll
total 28
-rw-r----- 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw---- 1 oracle oinstall 1544 Oct 10 12:28 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 initorcl.ora
-rw-r----- 1 oracle oinstall   24 Aug 23  2014 lkORCL
-rw-r----- 1 oracle oinstall 2048 Oct  8 15:28 orapworcl
-rw-r----- 1 oracle oinstall 3584 Oct 10 10:07 spfilehelowin.ora
[oracle@4cf60f36ccfe dbs]$ mv spfilehelowin.ora spfileorcl.ora
[oracle@4cf60f36ccfe dbs]$ ll
total 28
-rw-r----- 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw---- 1 oracle oinstall 1544 Oct 10 12:28 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 initorcl.ora
-rw-r----- 1 oracle oinstall   24 Aug 23  2014 lkORCL
-rw-r----- 1 oracle oinstall 2048 Oct  8 15:28 orapworcl
-rw-r----- 1 oracle oinstall 3584 Oct 10 10:07 spfileorcl.ora
[oracle@4cf60f36ccfe dbs]$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=sys entries=5 force=y
[oracle@4cf60f36ccfe dbs]$ ls -lrt orap*
-rw-r----- 1 oracle oinstall 2048 Oct 10 12:43 orapworcl

[oracle@4cf60f36ccfe dbs]$ ls -lrt orap*
-rw-r----- 1 oracle oinstall 2048 Oct 10 12:43 orapworcl
[oracle@4cf60f36ccfe dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Oct 10 12:45:30 2022

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

SQL> alter database backup controlfile to trace resetlogs;

Database altered.


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。