keytool.exe -genkey -alias juheon -keyalg RSA -keypass 1234qwer -storepass 1234qwer -keystore juheon.jks keytool.exe -export -alias juheon -storepass 1234qwer -file juheon.cer -keystore juheon.jks keytool.exe -importkeystore -srckeystore juheon.jks -destkeystore juheon.key.p12 -deststoretype PKCS12 D:\Java\32bit\jdk1.5.0_22\jre\lib\security\cacert D:\Java\32bit\jdk1.5.0_22\bin\keytool.exe -import -alias tsasample -keystore D:\Java\32bit\jdk1.5.0_22\jre\lib\security\cacert -file D:\workspace\Servers\tsa-server-web-config\tomcat.cer keytool -import -alias somansa -keystore C:\Program Files\Java\jdk1.8.0_102\jre\lib\security\cacert -file c:\somansa.cer #인증서 생성 keytool -genkey -alias keyAlias -keyalg RSA -keypass changeit -storepass changeit –validity 9999 -keystore keystore.jks keytool -export -alias keyAlias -storepass changeit -file server.cer -keystore keystore.jks keytool -import -v -trustcacerts -alias keyAlias -file server.cer ...
-- 인덱스 조회
SELECT table_name, constraint_name, constraint_type
FROM USER_CONSTRAINTS
WHERE TABLE_NAME ='PTL_PERSONAL_TILE_PORTLET';
-- PK 제거
ALTER TABLE PTL_PERSONAL_TILE_PORTLET DROP CONSTRAINT IDX_PTL_P_TILE_PORTLET_PK CASCADE;
-- 인덱스 생성
CREATE UNIQUE INDEX PK명 ON 테이블명 (컬럼명1, 컬럼명2....);
-- PK 생성
ALTER TABLE PTL_PERSONAL_TILE_PORTLET ADD (CONSTRAINT IDX_PTL_P_TILE_PORTLET_PK PRIMARY KEY (USER_ID, PAGE_ID, TILE_SEQ));
-- 계정 생성
CREATE USER nextree IDENTIFIED BY nextree
-- 계정 권한
GRANT connect, resource, dba TO [user_name];
-- 계정삭제
drop user 사용자계정 cascade;
-- 락걸린 테이블 확인
SELECT DO.OBJECT_NAME, DO.OWNER, DO.OBJECT_TYPE, DO.OWNER,
VO.XIDUSN, VO.SESSION_ID, VO.LOCKED_MODE
FROM V$LOCKED_OBJECT VO, DBA_OBJECTS DO
WHERE VO.OBJECT_ID = DO.OBJECT_ID;
-- 해당 테이블에 LOCK 이 걸렸는지.
SELECT A.SID, A.SERIAL#, B.TYPE, C.OBJECT_NAME
FROM V$SESSION A, V$LOCK B, DBA_OBJECTS C
WHERE A.SID = B.SID AND B.ID1 = C.OBJECT_ID
AND B.TYPE='TM' AND C.OBJECT_NAME IN ('TB_CO_GENO');
-- 락발생 사용자와 SQL, OBJECT 조회
SELECT DISTINCT X.SESSION_ID, A.SERIAL#, D.OBJECT_NAME, A.MACHINE, A.TERMINAL,
A.PROGRAM, B.ADDRESS, B.PIECE, B.SQL_TEXT
FROM V$LOCKED_OBJECT X, V$SESSION A, V$SQLTEXT B, DBA_OBJECTS D
WHERE X.SESSION_ID = A.SID AND
X.OBJECT_ID = D.OBJECT_ID AND A.SQL_ADDRESS = B.ADDRESS
ORDER BY B.ADDRESS, B.PIECE;
-- 현재 접속자의 SQL 분석
SELECT DISTINCT A.SID, A.SERIAL#,
A.MACHINE, A.TERMINAL, A.PROGRAM,
B.ADDRESS, B.PIECE, B.SQL_TEXT
FROM V$SESSION A, V$SQLTEXT B
WHERE A.SQL_ADDRESS = B.ADDRESS
ORDER BY A.SID, A.SERIAL#, B.ADDRESS, B.PIECE
-- 락 세션 죽이기
SELECT A.SID, A.SERIAL#
FROM V$SESSION A, V$LOCK B,
DBA_OBJECTS C
WHERE A.SID = B.SID
AND B.ID1 = C.OBJECT_ID
AND B.TYPE = 'TM'
AND C.OBJECT_NAME = 'TB_CO_GENO'
SID SERIAL#
--- -------
5 1
6 1
2. 다음 명령으로 SESSION들을 KILL한다. ALTER SYSTEM KILL SESSION 'SESSION_ID, SERIAL#';
SQL> alter system kill session '5, 1';
SQL> alter system kill session '6, 1';
-- 락 세션 죽이는 sql 문
SELECT DISTINCT X.SESSION_ID, A.SERIAL#, D.OBJECT_NAME, A.MACHINE, A.TERMINAL,
A.PROGRAM, A.LOGON_TIME, 'ALTER SYSTEM KILL SESSION'''||A.SID||', '||A.SERIAL#||''';'
FROM GV$LOCKED_OBJECT X, GV$SESSION A, DBA_OBJECTS D
WHERE X.SESSION_ID = A.SID AND X.OBJECT_ID = D.OBJECT_ID
ORDER BY LOGON_TIME;
SELECT table_name, constraint_name, constraint_type
FROM USER_CONSTRAINTS
WHERE TABLE_NAME ='PTL_PERSONAL_TILE_PORTLET';
-- PK 제거
ALTER TABLE PTL_PERSONAL_TILE_PORTLET DROP CONSTRAINT IDX_PTL_P_TILE_PORTLET_PK CASCADE;
-- 인덱스 생성
CREATE UNIQUE INDEX PK명 ON 테이블명 (컬럼명1, 컬럼명2....);
-- PK 생성
ALTER TABLE PTL_PERSONAL_TILE_PORTLET ADD (CONSTRAINT IDX_PTL_P_TILE_PORTLET_PK PRIMARY KEY (USER_ID, PAGE_ID, TILE_SEQ));
-- 계정 생성
CREATE USER nextree IDENTIFIED BY nextree
-- 계정 권한
GRANT connect, resource, dba TO [user_name];
-- 계정삭제
drop user 사용자계정 cascade;
-- 락걸린 테이블 확인
SELECT DO.OBJECT_NAME, DO.OWNER, DO.OBJECT_TYPE, DO.OWNER,
VO.XIDUSN, VO.SESSION_ID, VO.LOCKED_MODE
FROM V$LOCKED_OBJECT VO, DBA_OBJECTS DO
WHERE VO.OBJECT_ID = DO.OBJECT_ID;
-- 해당 테이블에 LOCK 이 걸렸는지.
SELECT A.SID, A.SERIAL#, B.TYPE, C.OBJECT_NAME
FROM V$SESSION A, V$LOCK B, DBA_OBJECTS C
WHERE A.SID = B.SID AND B.ID1 = C.OBJECT_ID
AND B.TYPE='TM' AND C.OBJECT_NAME IN ('TB_CO_GENO');
-- 락발생 사용자와 SQL, OBJECT 조회
SELECT DISTINCT X.SESSION_ID, A.SERIAL#, D.OBJECT_NAME, A.MACHINE, A.TERMINAL,
A.PROGRAM, B.ADDRESS, B.PIECE, B.SQL_TEXT
FROM V$LOCKED_OBJECT X, V$SESSION A, V$SQLTEXT B, DBA_OBJECTS D
WHERE X.SESSION_ID = A.SID AND
X.OBJECT_ID = D.OBJECT_ID AND A.SQL_ADDRESS = B.ADDRESS
ORDER BY B.ADDRESS, B.PIECE;
-- 현재 접속자의 SQL 분석
SELECT DISTINCT A.SID, A.SERIAL#,
A.MACHINE, A.TERMINAL, A.PROGRAM,
B.ADDRESS, B.PIECE, B.SQL_TEXT
FROM V$SESSION A, V$SQLTEXT B
WHERE A.SQL_ADDRESS = B.ADDRESS
ORDER BY A.SID, A.SERIAL#, B.ADDRESS, B.PIECE
-- 락 세션 죽이기
SELECT A.SID, A.SERIAL#
FROM V$SESSION A, V$LOCK B,
DBA_OBJECTS C
WHERE A.SID = B.SID
AND B.ID1 = C.OBJECT_ID
AND B.TYPE = 'TM'
AND C.OBJECT_NAME = 'TB_CO_GENO'
SID SERIAL#
--- -------
5 1
6 1
2. 다음 명령으로 SESSION들을 KILL한다. ALTER SYSTEM KILL SESSION 'SESSION_ID, SERIAL#';
SQL> alter system kill session '5, 1';
SQL> alter system kill session '6, 1';
-- 락 세션 죽이는 sql 문
SELECT DISTINCT X.SESSION_ID, A.SERIAL#, D.OBJECT_NAME, A.MACHINE, A.TERMINAL,
A.PROGRAM, A.LOGON_TIME, 'ALTER SYSTEM KILL SESSION'''||A.SID||', '||A.SERIAL#||''';'
FROM GV$LOCKED_OBJECT X, GV$SESSION A, DBA_OBJECTS D
WHERE X.SESSION_ID = A.SID AND X.OBJECT_ID = D.OBJECT_ID
ORDER BY LOGON_TIME;
댓글
댓글 쓰기