3. 업그레이드 준비 작업
3.1 파라미터 변경
프로세스 300 이상으로 변경
1
2
3
4
|
select NAME, VALUE from V$PARAMETER where NAME = 'processes';
alter system set processes=300 scope=spfile;
shutdown immediate;
startup
|
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:33:08 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> col NAME form a15
SQL> col VALUE form a10
SQL> select NAME, VALUE from V$PARAMETER where NAME = 'processes';
NAME VALUE
--------------- ----------
processes 150
SQL> alter system set processes=300;
alter system set processes=300
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> alter system set processes=300 scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2087780352 bytes
Fixed Size 2254824 bytes
Variable Size 1291847704 bytes
Database Buffers 788529152 bytes
Redo Buffers 5148672 bytes
Database mounted.
Database opened.
SQL> col NAME form a15
SQL> col VALUE form a10
SQL> select NAME, VALUE from V$PARAMETER where NAME = 'processes';
NAME VALUE
--------------- ----------
processes 300
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3.2 EM Repository 제거
삭제 스크립트 복제 및 EMDC 중지
1
2
|
cp <19c ORACLE_HOME 경로>/rdbms/admin/emremove.sql <11g ORACLE_HOME 경로>/rdbms/admin/
emctl stop dbconsole
|
[oracle@orcl ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@orcl ~]$ cp /u01/app/oracle/product/19c/db_1/rdbms/admin/emremove.sql /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/
[oracle@orcl ~]$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.4.0
Copyright (c) 1996, 2013 Oracle Corporation. All rights reserved.
https://dbup:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 11g Database Control ...
... Stopped.
환경 설정 후 삭제 스크립트 수행
1
2
3
|
SET ECHO ON;
SET SERVEROUTPUT ON;
@?/rdbms/admin/emremove.sql
|
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:40:43 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SET ECHO ON;
SQL> SET SERVEROUTPUT ON;
SQL> @?/rdbms/admin/emremove.sql
SQL> Rem
SQL> Rem $Header: rdbms/admin/emremove.sql /main/5 2017/05/28 22:46:05 stanaya Exp $
SQL> Rem
SQL> Rem emremove.sql
SQL> Rem
SQL> Rem Copyright (c) 2012, 2017, Oracle and/or its affiliates.
SQL> Rem All rights reserved.
SQL> Rem
SQL> Rem NAME
SQL> Rem emremove.sql - This script removes EM Schema from RDBMS
SQL> Rem
SQL> Rem DESCRIPTION
SQL> Rem This script will drop the Oracle Enterprise Manager related schemas and objects.
SQL> Rem This script might take few minutes to complete; it has 6 phases to complete the process.
SQL> Rem The script may take longer if you have SYSMAN and related sessions are active
SQL> Rem from Oracle Enterprise Manager(OEM) application.
SQL> Rem
SQL> Rem NOTES
SQL> Rem Please do following two steps before running this script
SQL> Rem set serveroutput on
SQL> Rem set echo on
SQL> Rem
SQL> Rem
SQL> Rem
SQL> Rem RECOMMENDATIONS
SQL> Rem
SQL> Rem You are recommended to shutdown DB Control application immediately before running this
SQL> Rem OEM repository removal script.
SQL> Rem To shutdown DB Control application, you need to run emctl stop dbconsole
SQL> Rem
SQL> Rem
SQL> Rem Steps to be performed manually (after this script is run)
SQL> Rem
SQL> Rem
SQL> Rem Please note that you need to remove the DB Control Configuration Files
SQL> Rem manually to remove DB Control completly; remove the following
SQL> Rem directories from your filesystem
SQL> Rem <ORACLE_HOME>/<hostname_sid>
SQL> Rem <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>
SQL> Rem
SQL> Rem If the dbcontrol is upgraded from lower version, for example, from 10.2.0.3 to 10.2.0.4,
SQL> Rem then the following directory also needs to be removed from the file system.
SQL> Rem <ORACLE_HOME>/<hostname_sid>.upgrade
SQL> Rem <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade
SQL> Rem
SQL> Rem On Microsoft platforms, also delete the DB Console service, generally with name
SQL> Rem OracleDBConsole<sid>
SQL> Rem
SQL> Rem #############################################################################################
SQL> Rem
SQL> Rem
SQL> Rem BEGIN SQL_FILE_METADATA
SQL> Rem SQL_SOURCE_FILE: rdbms/admin/emremove.sql
SQL> Rem SQL_SHIPPED_FILE: rdbms/admin/emremove.sql
SQL> Rem SQL_PHASE: UTILITY
SQL> Rem SQL_STARTUP_MODE: NORMAL
SQL> Rem SQL_IGNORABLE_ERRORS: NONE
SQL> Rem END SQL_FILE_METADATA
SQL> Rem
SQL> Rem MODIFIED (MM/DD/YY)
SQL> Rem spramani 01/17/17 - fix for 24518751
SQL> Rem spramani 08/03/16 - fix # 24330891
SQL> Rem spramani 07/20/12 - more fix
SQL> Rem spramani 12/21/11 - Created
SQL> Rem
SQL>
SQL>
SQL> DEFINE EM_REPOS_USER ="SYSMAN"
SQL> DEFINE LOGGING = "VERBOSE"
SQL>
SQL> declare
2
3 l_username dba_role_privs.grantee%type;
4 l_user_name dba_role_privs.grantee%type;
5 l_sql varchar2(1024);
6 l_sysman_user number;
7 l_mgmt_users_src number;
8 l_sid number;
9 l_serial number;
10 err number;
11 err_msg varchar2(128);
12 c number;
13 l_removejobs varchar2(1024);
14 l_set_context varchar2(1024);
15 l_client varchar2(16) := ' ';
16 l_context integer := 5;
17 l_verbose boolean := FALSE;
18 l_msg varchar2(1024);
19 l_open_acc number := 0;
20
21 TYPE SESSION_REC IS RECORD
22 (sid v$session.sid%type,
23 serial_no v$session.serial#%type);
24 TYPE SESSION_TYPE IS TABLE OF SESSION_REC;
25 l_sessions SESSION_TYPE;
26
27
28
29 l_job_process_count NUMBER ;
30 TYPE TBSP_ARRAY IS TABLE OF varchar2(64) INDEX BY BINARY_INTEGER ;
31 l_tablespaces TBSP_ARRAY;
32
33 PROCEDURE set_job_process_count(p_count IN NUMBER)
34 IS
35 BEGIN
36 --scope=memory so it will be reset on instance startup
37 -- SID=* to take care of RAC
38 IF p_count >=0
39 THEN
40 EXECUTE IMMEDIATE 'ALTER SYSTEM SET job_queue_processes='
41 ||p_count||' SID=''*'' scope=memory' ;
42 END IF ;
43 EXCEPTION WHEN OTHERS THEN NULL ;
44 END set_job_process_count ;
45
46 PROCEDURE LOG_MESSAGE (verbose boolean, message varchar2)
47 IS
48 BEGIN
49 IF (verbose = TRUE)
50 THEN
51 DBMS_OUTPUT.PUT_LINE(message);
52 END IF;
53 END LOG_MESSAGE;
54
55 FUNCTION get_job_process_count
56 RETURN NUMBER
57 IS
58 l_value NUMBER ;
59 BEGIN
60 SELECT value
61 INTO l_value
62 FROM v$parameter
63 WHERE name = 'job_queue_processes' ;
64 RETURN(l_value) ;
65 EXCEPTION
66 WHEN OTHERS THEN
67 RETURN(10) ;
68 END get_job_process_count ;
69 begin
70 IF (upper('&LOGGING') = 'VERBOSE')
71 THEN
72 l_verbose := TRUE;
73 END IF;
74
75 LOG_MESSAGE(l_verbose,' This script will drop the Oracle Enterprise Manager related schemas and objects.');
76 LOG_MESSAGE(l_verbose, ' This script might take few minutes to complete; it has 6 phases to complete the process.');
77 LOG_MESSAGE(l_verbose,' The script may take longer if you have SYSMAN and related sessions are active');
78 LOG_MESSAGE(l_verbose,' from Oracle Enterprise Manager(OEM) application.');
79 LOG_MESSAGE(l_verbose,' ');
80 LOG_MESSAGE(l_verbose,' ');
81 LOG_MESSAGE(l_verbose,' Recommendations:');
82 LOG_MESSAGE(l_verbose,' ');
83 LOG_MESSAGE(l_verbose,' ');
84 LOG_MESSAGE(l_verbose,' You are recommended to shutdown DB Control application immediately before running this');
85 LOG_MESSAGE(l_verbose,' OEM repository removal script.');
86 LOG_MESSAGE(l_verbose,' To shutdown DB Control application, you need to run: emctl stop dbconsole');
87 LOG_MESSAGE(l_verbose,' ');
88 LOG_MESSAGE(l_verbose,' ');
89 LOG_MESSAGE(l_verbose,' Steps to be performed manually (after this script is run):');
90 LOG_MESSAGE(l_verbose,' ');
91 LOG_MESSAGE(l_verbose,' ');
92 LOG_MESSAGE(l_verbose,' Please note that you need to remove the DB Control Configuration Files');
93 LOG_MESSAGE(l_verbose,' manually to remove DB Control completly; remove the following');
94 LOG_MESSAGE(l_verbose,' directories from your filesystem:');
95 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/<hostname_sid>');
96 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>');
97 LOG_MESSAGE(l_verbose,' ');
98 LOG_MESSAGE(l_verbose,' If the dbcontrol is upgraded from lower version, for example, from 10.2.0.3 to 10.2.0.4,');
99 LOG_MESSAGE(l_verbose,' then the following directory also needs to be removed from the file system.');
100 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/<hostname_sid>.upgrade');
101 LOG_MESSAGE(l_verbose,' <ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade');
102 LOG_MESSAGE(l_verbose,' ');
103 LOG_MESSAGE(l_verbose,' On Microsoft platforms, also delete the DB Console service, generally with name');
104 LOG_MESSAGE(l_verbose,' OracleDBConsole<sid>');
105
106
107 LOG_MESSAGE(l_verbose,'Starting phase 1 : Dropping AQ related objests, EM jobs and all Oracle Enterprise Manager related schemas; except SYSMAN ...');
108
109 c := 0;
110 BEGIN
111 select count(1) into l_sysman_user from all_users where username='SYSMAN';
112 IF (l_sysman_user > 0 ) THEN
113 BEGIN
114
115 BEGIN
116 LOG_MESSAGE(l_verbose,'dropping AQ related objests from SYSMAN ...');
117
118 DBMS_AQADM.DROP_QUEUE_TABLE(queue_table=>'SYSMAN.MGMT_NOTIFY_QTABLE',force=>TRUE);
119 EXCEPTION
120 WHEN OTHERS THEN
121 err := SQLCODE;
122 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: AQ related objects are dropped already or not found');
123 END;
124
125 BEGIN
126 -- reduce job_queue_processes to zero
127 l_job_process_count := get_job_process_count ;
128 set_job_process_count(0) ;
129 LOG_MESSAGE(l_verbose,'saved job_queue_process=' || l_job_process_count || ', set to 0, now removing Oracle EM jobs ...');
130 l_removejobs := 'BEGIN ' || 'SYSMAN' || '.emd_maintenance.remove_em_dbms_jobs; END;';
131 execute immediate l_removejobs;
132 EXCEPTION
133 WHEN OTHERS THEN
134 err := SQLCODE;
135 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: EM jobs are dropped already or not found');
136 END;
137
138 END;
139 END IF;
140 END;
141
142 -- First, drop all users, except SYSMAN who have MGMT_USER role and
143 -- are created by EM. All users created by EM will have a record
144 -- in MGMT_CREATED_USERS table
145 --
146
147 BEGIN
148 select count(1) into l_sysman_user from all_users where username='SYSMAN';
149 IF (l_sysman_user > 0 ) THEN
150 BEGIN
151
152 LOOP -- part 1 main loop
153 -- handle SYSMAN is partially dropped
154 select count(1) into l_mgmt_users_src from all_objects where object_name='MGMT_CREATED_USERS' and owner='SYSMAN';
155 IF(l_mgmt_users_src = 0 ) THEN
156 EXIT;
157 END IF;
158 BEGIN
159 LOG_MESSAGE(l_verbose,'finding users who needs to be dropped ...');
160 l_username := '';
161 BEGIN
162 execute immediate 'select grantee
163 from sys.dba_role_privs
164 where granted_role ='||DBMS_ASSERT.ENQUOTE_LITERAL('MGMT_USER')||
165 ' AND grantee IN (SELECT user_name
166 FROM SYSMAN.MGMT_CREATED_USERS
167 WHERE SYSTEM_USER=0)
168 AND ROWNUM=1'
169 into l_user_name;
170 LOG_MESSAGE(l_verbose,'found user name: ' || l_user_name);
171 l_username := DBMS_ASSERT.ENQUOTE_NAME(l_user_name, FALSE);
172
173 EXECUTE IMMEDIATE 'ALTER USER '||l_username||' ACCOUNT LOCK' ;
174 EXCEPTION
175 WHEN NO_DATA_FOUND THEN
176 LOG_MESSAGE(l_verbose,l_username || ' IS ALREADY DROPPED');
177 EXIT; -- THEN RETURN ;
178 END ;
179
180
181 FOR cnt in 1 .. 150 LOOP -- session kill loop
182
183 BEGIN
184 -- FOR crec in (SELECT sid, serial#
185 -- FROM v$session
186 -- WHERE username=l_username
187 -- AND status NOT IN('KILLED'))
188
189 l_sql := 'SELECT sid, serial#
190 FROM v$session
191 WHERE username='|| DBMS_ASSERT.ENQUOTE_LITERAL(l_user_name)||'
192 AND status NOT IN(''KILLED'')';
193 execute immediate l_sql BULK COLLECT INTO l_sessions;
194
195 FOR i in 1..l_sessions.COUNT
196 LOOP -- cursor loop
197 BEGIN
198 LOG_MESSAGE(l_verbose,'killing related sessions : sid= ' || l_sessions(i).sid || ' serial#= ' || l_sessions(i).serial_no || ' ...');
199 EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ' || DBMS_ASSERT.ENQUOTE_LITERAL(l_sessions(i).sid || ',' || l_sessions(i).serial_no)||' IMMEDIATE';
200 EXCEPTION
201 WHEN OTHERS THEN
202 err := SQLCODE;
203 IF err != -30 THEN
204 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no session found; or already killed.');
205 EXIT;
206 END IF;
207 END;
208 COMMIT;
209 END LOOP; -- end cursor loop
210
211 EXCEPTION
212 WHEN OTHERS THEN
213 err := SQLCODE;
214 IF err != -30 THEN
215 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no session found; or already killed.');
216 EXIT;
217 END IF;
218 END;
219
220 IF SQL%NOTFOUND THEN
221 LOG_MESSAGE(l_verbose,'found [sql%notfound]: no session found; or already killed.');
222 EXIT;
223 END IF;
224
225 COMMIT;
226
227 END LOOP; -- end session killing loop
228 LOG_MESSAGE(l_verbose,' Dropping user : ' || l_username || '...');
229
230 EXECUTE IMMEDIATE 'drop user ' || l_username || ' cascade';
231 exit;
232 EXCEPTION
233 WHEN NO_DATA_FOUND THEN
234 LOG_MESSAGE(l_verbose,'found [no_data_found]: no user/corresponding sessions found related to DB Control');
235 EXIT;
236 WHEN OTHERS THEN
237 err := SQLCODE;
238 IF err = -1918 THEN
239 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no DB Control user/corresponding sessions found related to DB Control');
240 EXIT;
241 ELSE
242 IF err = -1940 THEN
243 NULL;
244 ELSE
245 -- keep count of try to drop EM related user and sessions
246 -- give up after 50 try
247
248 c := c+1;
249 IF c > 50 THEN
250 RAISE;
251 END IF;
252 END IF;
253 END IF;
254 END;
255 END LOOP; -- end part main loop
256 END;
257 ELSE
258 LOG_MESSAGE(l_verbose,'SYSMAN IS ALREADY DROPPED');
259 END IF;
260 END;
261
262 BEGIN
263 -- Now, drop the SYSMAN user
264 LOG_MESSAGE(l_verbose,'Finished phase 1');
265 LOG_MESSAGE(l_verbose,'Starting phase 2 : Dropping SYSMAN schema ...');
266
267 c := 0;
268 -- validate user exists
269 select count(1) into l_sysman_user from all_users where username='SYSMAN';
270 IF (l_sysman_user > 0 ) THEN
271 BEGIN
272
273 BEGIN
274 -- SELECT username
275 -- INTO l_username
276 -- FROM dba_users
277 -- WHERE username = 'SYSMAN';
278 -- l_user_name := 'SYSMAN';
279 -- l_username = DBMS_ASSERT.ENQUOTE_NAME(l_user_name);
280 EXECUTE IMMEDIATE 'ALTER USER SYSMAN ACCOUNT LOCK' ;
281 EXCEPTION
282 WHEN NO_DATA_FOUND THEN
283 LOG_MESSAGE(l_verbose,'SYSMAN IS ALREADY DROPPED');
284 -- THEN RETURN ;
285 END ;
286
287
288 BEGIN
289 LOOP -- main loop
290 BEGIN
291 FOR cnt in 1 .. 150 LOOP -- session kill loop
292 BEGIN
293 FOR crec in (SELECT sid, serial#
294 FROM gv$session
295 WHERE (username='SYSMAN' OR
296 schemaname='SYSMAN')
297 AND status != 'KILLED')
298 LOOP --cursor loop
299 BEGIN
300 LOG_MESSAGE(l_verbose,'killing related sessions : sid= ' || crec.sid || ' serial#= ' || crec.serial# || ' ...');
301 EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ' ||
302 DBMS_ASSERT.ENQUOTE_LITERAL(crec.sid || ',' || crec.serial#)|| ' IMMEDIATE';
303 EXCEPTION
304 WHEN OTHERS THEN
305 err := SQLCODE;
306 IF err != -30 THEN
307 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: SYSMAN related sessions are already killed; no session found');
308 EXIT;
309 END IF;
310 END;
311 COMMIT;
312 END LOOP; -- cursor loop ends
313 EXCEPTION
314 WHEN OTHERS THEN
315 err := SQLCODE;
316 IF err != -30 THEN
317 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: SYSMAN related sessions are already killed; no session found');
318 EXIT;
319 END IF;
320 END;
321 IF SQL%NOTFOUND THEN
322 LOG_MESSAGE(l_verbose,'found [sql%notfound]: SYSMAN related sessions are already killed; no session found');
323 EXIT;
324 END IF;
325 COMMIT;
326 END LOOP; -- end of session kill loop
327
328 -- END;
329 LOG_MESSAGE(l_verbose,'dropping user : ' || l_user_name || '...');
330 execute immediate 'drop user SYSMAN cascade';
331 set_job_process_count(l_job_process_count) ;
332 exit;
333
334 -- >> START - Dropping the Tablespaces
335 LOG_MESSAGE(l_verbose,'Finished phase 2');
336 LOG_MESSAGE(l_verbose,'Starting phase 3 : Dropping Oracle Enterprise Manager related tablespaces ...');
337
338 LOG_MESSAGE(l_verbose,'No seperate TABLESPACES Exist for EM; all in SYSAUX; no action taken');
339 -- >> END - Dropping the Tablespaces
340
341 EXCEPTION
342 WHEN NO_DATA_FOUND THEN
343 LOG_MESSAGE(l_verbose,'found [ no_data_found]: no sysman/corresponding sessions');
344 EXIT;
345 WHEN OTHERS THEN
346 err := SQLCODE;
347 IF err = -1918 THEN
348 LOG_MESSAGE(l_verbose,'found [sqlcode:1918]: no sysman/corresponding sessions');
349 EXIT;
350 ELSIF err = -1940 THEN
351 NULL;
352 ELSE
353 LOG_MESSAGE(l_verbose,'found [sqlcode:'||err||']: no sysman/corresponding sessions');
354 c := c+1;
355 IF c > 50 THEN
356 RAISE;
357 END IF;
358 END IF;
359 END;
360 END LOOP; -- end of main loop
361 END;
362 LOG_MESSAGE(l_verbose,'SYSMAN dropped');
363 commit;
364 END;
365 ELSE
366 LOG_MESSAGE(l_verbose,'SYSMAN is already dropped');
367 END IF;
368 EXCEPTION
369 WHEN OTHERS THEN
370 set_job_process_count(l_job_process_count) ;
371 RAISE ;
372 END;
373
374 BEGIN
375
376 -- Drop basic roles.
377 LOG_MESSAGE(l_verbose,'Finished phase 3');
378 LOG_MESSAGE(l_verbose,'Starting phase 4 : Dropping Oracle Enterprise Manager related MGMT_USER role ...');
379
380 BEGIN
381 execute immediate 'drop role MGMT_USER';
382 EXCEPTION
383 WHEN OTHERS THEN
384 LOG_MESSAGE(l_verbose,'Role MGMT_USER already dropped');
385 END;
386 --
387 -- Drop the following synonyms related to REPOS Schema
388 --
389 LOG_MESSAGE(l_verbose,'Finished phase 4');
390 LOG_MESSAGE(l_verbose,'Starting phase 5 : Dropping Oracle Enterprise Manager related public synonyms ...');
391
392
393 BEGIN
394 FOR crec in (SELECT synonym_name,table_owner,table_name
395 FROM dba_synonyms
396 WHERE owner = 'PUBLIC'
397 AND table_owner = 'SYSMAN')
398 LOOP
399 BEGIN
400 LOG_MESSAGE(l_verbose,'Dropping synonym : ' || crec.synonym_name || ' ... ');
401 EXECUTE IMMEDIATE 'DROP PUBLIC SYNONYM ' || DBMS_ASSERT.SIMPLE_SQL_NAME(crec.synonym_name);
402
403 EXCEPTION
404 when others then
405 LOG_MESSAGE(l_verbose,'Public synonym ' || crec.synonym_name ||
406 ' cannot be dropped');
407 -- continue dropping other synonyms.
408 END;
409 END LOOP;
410 END;
411
412 BEGIN
413 LOG_MESSAGE(l_verbose,'Finished phase 5');
414 LOG_MESSAGE(l_verbose,'Starting phase 6 : Dropping Oracle Enterprise Manager related other roles ...');
415 FOR crec in (select role from sys.dba_roles where role like 'MGMT_%')
416 LOOP
417 LOG_MESSAGE(l_verbose,'Dropping role: ' || crec.role ||' ...');
418 execute immediate 'drop role ' || DBMS_ASSERT.SIMPLE_SQL_NAME(crec.role);
419 commit;
420 END LOOP;
421 EXCEPTION
422 when NO_DATA_FOUND THEN
423 LOG_MESSAGE(l_verbose,'Roles like MGMT% do not exist');
424 WHEN OTHERS THEN
425 err := SQLCODE;
426 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: no MGMT% roles to drop');
427 END;
428
429 -- lock DBSNMP user
430 BEGIN
431 BEGIN
432 LOG_MESSAGE(l_verbose,'Process DBSNMP user');
433 select count(1) into l_open_acc from DBA_USERS where USERNAME ='DBSNMP' and ACCOUNT_STATUS='OPEN';
434 EXCEPTION
435 when NO_DATA_FOUND THEN
436 LOG_MESSAGE(l_verbose,'User DBSNMP does not exist');
437 WHEN OTHERS THEN
438 err := SQLCODE;
439 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: while checking DBSNMP user status');
440
441 END;
442
443 IF (l_open_acc > 0 ) THEN
444 BEGIN
445 execute immediate 'ALTER USER DBSNMP PASSWORD EXPIRE';
446 LOG_MESSAGE(l_verbose,'DBSNMP user password is made expired');
447 EXCEPTION
448 WHEN OTHERS THEN
449 err := SQLCODE;
450 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: while expiring DBSNMP user password');
451 END;
452
453 BEGIN
454 execute immediate 'ALTER USER DBSNMP ACCOUNT LOCK';
455 LOG_MESSAGE(l_verbose,'User DBSNMP is locked');
456 EXCEPTION
457 WHEN OTHERS THEN
458 err := SQLCODE;
459 LOG_MESSAGE(l_verbose,'found [sqlcode: '||SQLCODE||']: while locking DBSNMP user');
460 END;
461
462 END IF;
463 LOG_MESSAGE(l_verbose,'Done processing DBSNMP user');
464 END;
465
466 LOG_MESSAGE(l_verbose,'Finished phase 6');
467 LOG_MESSAGE(l_verbose,'The Oracle Enterprise Manager related schemas and objects are dropped.');
468 LOG_MESSAGE(l_verbose,'Do the manual steps to studown the DB Control if not done before running this script and then delete the DB Control configuration files');
469 commit;
470 END;
471 END;
472 /
old 70: IF (upper('&LOGGING') = 'VERBOSE')
new 70: IF (upper('VERBOSE') = 'VERBOSE')
This script will drop the Oracle Enterprise Manager related schemas and objects.
This script might take few minutes to complete; it has 6 phases to complete the
process.
The script may take longer if you have SYSMAN and related sessions are active
from Oracle Enterprise Manager(OEM) application.
Recommendations:
You are recommended to shutdown DB Control application immediately before
running this
OEM repository removal script.
To shutdown DB Control application, you need to run: emctl stop dbconsole
Steps to be performed manually (after this script is run):
Please note that you need to remove the DB Control Configuration Files
manually to remove DB Control completly; remove the following
directories from your filesystem:
<ORACLE_HOME>/<hostname_sid>
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>
If the dbcontrol is upgraded from lower version, for example, from 10.2.0.3 to
10.2.0.4,
then the following directory also needs to be removed from the file system.
<ORACLE_HOME>/<hostname_sid>.upgrade
<ORACLE_HOME>/oc4j/j2ee/OC4J_DBConsole_<hostname>_<sid>.upgrade
On Microsoft platforms, also delete the DB Console service, generally with name
OracleDBConsole<sid>
Starting phase 1 : Dropping AQ related objests, EM jobs and all Oracle
Enterprise Manager related schemas; except SYSMAN ...
dropping AQ related objests from SYSMAN ...
saved job_queue_process=1000, set to 0, now removing Oracle EM jobs ...
finding users who needs to be dropped ...
found user name: MGMT_VIEW
found [sql%notfound]: no session found; or already killed.
Dropping user : "MGMT_VIEW"...
Finished phase 1
Starting phase 2 : Dropping SYSMAN schema ...
found [sql%notfound]: SYSMAN related sessions are already killed; no session
found
dropping user : MGMT_VIEW...
SYSMAN dropped
Finished phase 3
Starting phase 4 : Dropping Oracle Enterprise Manager related MGMT_USER role ...
Finished phase 4
Starting phase 5 : Dropping Oracle Enterprise Manager related public synonyms
...
Dropping synonym : ECM_UTIL ...
... << 중략 >> ...
Dropping synonym : SMP_EMD_TARGET_OBJ_ARRAY ...
Finished phase 5
Starting phase 6 : Dropping Oracle Enterprise Manager related other roles ...
Process DBSNMP user
DBSNMP user password is made expired
User DBSNMP is locked
Done processing DBSNMP user
Finished phase 6
The Oracle Enterprise Manager related schemas and objects are dropped.
Do the manual steps to studown the DB Control if not done before running this
script and then delete the DB Control configuration files
PL/SQL procedure successfully completed.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
3.3 OLAP Catalog 제거
OLAP Catalog 삭제
1
2
|
@?/olap/admin/catnoamd.sql
purge dba_recyclebin;
|
[oracle@orcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 5 10:42:11 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @?/olap/admin/catnoamd.sql
Synonym dropped.
... << 중략 >> ...
Type dropped.
PL/SQL procedure successfully completed.
Role dropped.
PL/SQL procedure successfully completed.
1 row deleted.
SQL> purge dba_recyclebin;
DBA Recyclebin purged.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
'DATABASE > ORACLE' 카테고리의 다른 글
오라클 엔터프라이즈 매니저(Oracle Enterprise Manager) (0) | 2022.10.13 |
---|---|
[오라클] 업그레이드 #4 - Oracle database upgrade (11.2.x to 19.x) (0) | 2022.10.10 |
[오라클] 업그레이드 #3 - Oracle database upgrade (11.2.x to 19.x) (0) | 2022.10.10 |
[오라클] 업그레이드 #1 - Oracle database upgrade (11.2.x to 19.x) (0) | 2022.10.10 |
댓글