블로그 이미지
보미아빠

카테고리

보미아빠, 석이 (532)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total
Today
Yesterday

달력

« » 2025.11
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

공지사항

최근에 올라온 글

ag readonly

카테고리 없음 / 2016. 3. 22. 10:03


http://www.overtop.co.kr/136




가용성 그룹에 대한 읽기 전용 라우팅 구성(SQL Server)
Configure Read-Only Routing for an Availability Group
https://msdn.microsoft.com/library/hh710054.aspx

읽기전용 라우팅을 언제 사용해야 적절할까는 고민할 부분이다.

 

[환경]

AG1㈜, AG2(보조), AG3(보조) 의 복제복이 존재한다.

[Action Plan]

A. 필수 구성 요소

가용성 그룹 수신기 있어야 한다.

읽기전용 보조 복제복이 있어야 한다.

B. 적용은 T-SQL 또는 PowerShell 로만 적용이 가능하다.

 

 

 

-- 1. 읽기전용 라우팅 설정 하기

/*

읽기전용이란 이름으로 정의하였기 때문에 보조복제본의 연결은 모두 ALL 이 아닌 READ_ONLY 이어야 한다.

아래 설정변경은 주복제본에서만 수행이 된다.

*/

use master

go

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON N'AG1' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY))

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON N'AG2' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY))

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON N'AG3' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY))

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON

N'AG1' WITH

(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://AG1.overtop.local:1433'));

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON

N'AG2' WITH

(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://AG2.overtop.local:1433'));

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON

N'AG3' WITH

(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://AG3.overtop.local:1433'));

 

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON

N'AG1' WITH

(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('AG2','AG3','AG1')));

-- AG1 이 주 복제본일경우에 라우팅은 AG3 로 연결되며, AG3 가 접속이 안되는 경우에는 AG2 로 자동연결 된다.

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON

N'AG2' WITH

(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('AG3','AG1','AG2')));

 

ALTER AVAILABILITY GROUP AGName

MODIFY REPLICA ON

N'AG3' WITH

(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('AG1','AG2','AG3')));

GO

 

 

-- 2. 설정 확인하기.

SELECT * FROM sys.availability_read_only_routing_lists

GO

 

SELECT ag.name as "Availability Group", ar.replica_server_name as "When Primary Replica Is",

rl.routing_priority as "Routing Priority", ar2.replica_server_name as "RO Routed To",

ar.secondary_role_allow_connections_desc, ar2.read_only_routing_url

FROM sys.availability_read_only_routing_lists rl

inner join sys.availability_replicas aon rl.replica_id = ar.replica_id

inner join sys.availability_replicas ar2 on rl.read_only_replica_id = ar2.replica_id

inner join sys.availability_groups ag on ar.group_id = ag.group_id

ORDER BY ag.name, ar.replica_server_name, rl.routing_priority

 

 

C. 라우팅 연결 테스트

-K , -d 옵션을 필수 입력해야 확인이 가능하다.
주 복제본에 따라 라우팅 순서를 정의할 수 있다. 위 코드 상에서 AG2가 주 복제복일경우에는 AG3 리턴한다.

sqlcmd -S Aglistener.overtop.local,62000 -E -K ReadOnly -d AGDB1 -Q "select @@servername"

 

 

[참고문서]

Modifying AlwaysOn Read Only Routing Lists
http://blogs.msdn.com/b/alwaysonpro/archive/2014/01/22/modifying-alwayson-read-only-routing-lists.aspx




192.168.137.5에 연결하는 중...

메시지 41158, 수준 16, 상태 3, 줄 65

로컬 가용성 복제본을 가용성 그룹 'poc_ag'에 조인하지 못했습니다. 작업 중 SQL Server 오류 41106이(가) 발생하여 작업이 롤백되었습니다. 자세한 내용은 SQL Server 오류 로그를 확인하십시오. 나중에 오류 원인을 해결한 후 ALTER AVAILABILITY GROUP JOIN 명령을 다시 시도하십시오.

192.168.137.5에서 연결을 끊는 중...

주서버에서 transaction log backup 후 보조서버에서 norecovery 로 복구 후 조인하면 된다. 


쿼럼 구성



클라이언트가 ad 도메인에 없을경우 


클라이언트의 host 에 도메인 이름을 명시적으로 쓰던지 

아래와 같이 리스너 구성을 명시적으로 ip 를 기술한다. 



ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON N'mhv1' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY))


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON N'mhv2' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY))


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON N'chv1' WITH (SECONDARY_ROLE(ALLOW_CONNECTIONS = READ_ONLY))


 


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON

N'mhv1' WITH (SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://192.168.137.4:1433'));


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON

N'mhv2' WITH (SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://192.168.137.5:1433'));


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON

N'chv1' WITH (SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://192.168.137.6:1433'));


 


 


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON

N'mhv1' WITH

(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('chv1','mhv2','mhv1')));

-- AG1 이 주 복제본일경우에 라우팅은 AG3 로 연결되며, AG3 가 접속이 안되는 경우에는 AG2 로 자동연결 된다.


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON

N'mhv2' WITH

(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('chv1','mhv1','mhv2')));


ALTER AVAILABILITY GROUP poc_ag

MODIFY REPLICA ON

N'chv1' WITH

(PRIMARY_ROLE (READ_ONLY_ROUTING_LIST=('mhv2','mhv1','chv1')));

GO





jdbc test







package com.company;
import java.sql.*;
public class Main {

public static void RunQuery() throws ClassNotFoundException, SQLException, InterruptedException
{

String url = "jdbc:sqlserver://192.168.137.44;DatabaseName=cafedb;ApplicationIntent=ReadOnly";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection(url, "test", "1234!@#$");
stmt = conn.createStatement();
rs = stmt.executeQuery("select @@servername ServerName");

rs.next();
System.out.println(rs.getString("ServerName"));
Thread.sleep(500);

rs.close();
stmt.close();
conn.close();
}

public static void main(String[] args)
{
Integer i = 0;
while (1 == 1)
{
i++;
try
{
Main.RunQuery();
System.out.println(i);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
}



Posted by 보미아빠
, |

10퍼센트 처리되었습니다.

20퍼센트 처리되었습니다.

30퍼센트 처리되었습니다.

40퍼센트 처리되었습니다.

50퍼센트 처리되었습니다.

60퍼센트 처리되었습니다.

70퍼센트 처리되었습니다.

80퍼센트 처리되었습니다.

90퍼센트 처리되었습니다.

100퍼센트 처리되었습니다.

파일 1에서 데이터베이스 'userDatabase', 파일 'userDatabase_Data'에 대해 0개의 페이지를 처리했습니다 .

파일 1에서 데이터베이스 'userDatabase', 파일 'userDatabase_Data2'에 대해 0개의 페이지를 처리했습니다 .

파일 1에서 데이터베이스 'userDatabase', 파일 'userDatabase_Data3'에 대해 0개의 페이지를 처리했습니다 .

파일 1에서 데이터베이스 'userDatabase', 파일 'userDatabase_GUEST'에 대해 0개의 페이지를 처리했습니다 .

파일 1에서 데이터베이스 'userDatabase', 파일 'userDatabase_z1'에 대해 0개의 페이지를 처리했습니다 .

파일 1에서 데이터베이스 'userDatabase', 파일 'userDatabase_Log'에 대해 234355개의 페이지를 처리했습니다 .

메시지 3456, 수준 16, 상태 1, 줄 1

페이지 (1:828275), 데이터베이스 'userDatabase'(데이터베이스 ID 5)에서 트랜잭션 ID (16:395253956)에 대한 로그 레코드 (3529369:96028:38)을(를) 다시 실행할 수 없습니다. 페이지: LSN = (3529369:95946:19), 유형 = 2. 로그: OpCode = 3, 컨텍스트 19, PrevPageLSN: (3529369:95244:5). 데이터베이스 백업에서 복원하거나 데이터베이스를 복구하십시오.

메시지 9004, 수준 16, 상태 6, 줄 1

데이터베이스 'userDatabase'의 로그를 처리하는 동안 오류가 발생했습니다. 가능하면 백업을 사용하여 복원하십시오. 백업이 없을 경우 로그를 다시 만들어야 합니다.

메시지 3013, 수준 16, 상태 1, 줄 1

RESTORE LOG이(가) 비정상적으로 종료됩니다.


다음 로그를 더 복구할 수 없다. 



내용을 보니 현재 처리중인 LSN (3529369:95946:19) 과 이전 LSN (3529369:95244:5) 이 맞지 않아 나는 에러인데....왜 이런 현상이 일어나는지는 이해할 수 없네...


테스트가 필요한 부분은 데이터베이스 커럽션이 있는지

차등백업 후 로그백업을 복구하면 에러없이 진행 가능한지 등이 있겠다. 

최후의 수단으로 CONTINUE_AFTER_ERROR 가 있을 수 있다. 


읽어볼만한 글

http://dba.stackexchange.com/questions/93473/unable-to-restore-error-3456

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/36dd0107-ceca-4d48-8523-3c5624c135b2/msg-3456-level-16-state-1-could-not-redo-log-record?forum=sqldatabaseengine

https://www.mssqltips.com/sqlservertip/3209/understanding-sql-server-log-sequence-numbers-for-backups/


복사본

In order to understanding why error 3456 would be thrown, we need to take a little step back and understand how SQL Server handles this corner of recovery.

When SQL Server is redoing an operation, and that redo is a page modification, it makes a quick check. In the page header there is ultimately going to be a PageLSN, which is an indication of the last LSN that has modified that page, recorded by the page. Think about it like this, the page keeps track of the last LSN that has made modifications to it. This is the PageLSN.

Every time there is a logged page modification operation, that log record includes a few LSNs. Namely, the log record's LSN (think... Current LSN), and then it has what's called the Previous Page LSN (PrevPageLSN going forward). So when we modify a page, one of the pieces of data that is put into the log record is what the page indicates as being the last LSN before you to have modified the page.

Think about it like this... Your car needs to have work done on it. Mechanic John works on your car, and in the engine bay it has a little tag and Mechanic John writes "John worked on this car last". Then the next time you take your car in to another shop, Mechanic Mark looks in the engine bay and sees that Mechanic John worked on this car last. On his data sheet he writes this information. Same idea with SQL Server.

This can be somewhat confusing, so take a look at this image below on sequential page modifications, and how the PageLSN and PrevPageLSN relate:

enter image description here

Let's loop back around, as this all comes into play when you need to redo an operation on a page (restores, recovery, HA, etc.). When SQL Server needs to redo a page operation, it makes a sanity check to see if the PageLSN on the page matches the PrevPageLSN that the log record includes. If that is not equal, then you will see error 3456 get thrown.

Does PageLSN equal PrevPageLSN? No??? Stop and raise error 3456...

Let's analyze your error message, which includes the how:

Could not redo log record (210388:123648:232), for transaction ID (0:1016710921), on page (4:8088), database 'SomeDB' (database ID 6). Page: LSN = (0:0:1), type = 11. Log: OpCode = 4, context 11, PrevPageLSN: (210388:122007:1). Restore from a backup of the database, or repair the database. Msg 3013, Level 16, State 1, Line 1 RESTORE LOG is terminating abnormally.

I have bold'd the two pieces of data that have an inequality causing the error. You can see that our PageLSN is 0:0:1 (this was found in the page's header), and our PrevPageLSN is 210388:122007:1(this was found in the data on the log record that was attempting to be redone). These are obviously not equal, hence err3456.

So in order to find out the why of this event, would be to find out why there is a disparity here. We really need to trace the lifecycle of page 4:8088 and see where the disconnect is. Unfortunately without further information, or hands-on troubleshooting there isn't much else I can do besides give you the background of this recovery operation and what causes the error.

shareimprove this answer







Problem

This tip describes SQL Server Log Sequence Numbers (LSNs) and how the sequence numbers link full, differential and transaction log backups.  We will look at sample backups and how these LSN values can be read from the backup files to determine the restore path.

Solution

This tip is the continuation from this tip, Different Ways to Restore a SQL Server Database, and utilizes the same database creation and backup scripts to explain how the SQL Server full, differential and transaction log backup chain is mapped between each backup type. If you want to follow along, please read this first tip and setup your database and backups.

RESTORE HEADERONLY

When restoring a database, the initial database RESTORE sequence must begin from a FULL database backup. A database RESTORE sequence cannot begin with a differential file backup or transaction log backup. When restoring databases there are four important LSNs: FirstLSN, LastLSN, CheckpointLSN and DatabaseBackupLSN.  These values can be retrieved from a SQL Server backup file using the RESTORE HEADERONLY command.

You can use RESTORE HEADERONLY to retrieve the backup header information for each backup file on disk as shown below.

USE [master]
RESTORE HEADERONLY FROM DISK = N'C:\Temp\F1.BAK'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T1.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T2.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\D1.BAK'



SQL Server Log Sequence Numbers (LSNs)

I have collated the FirstLSN, LastLSN, CheckpointLSN and DatabaseBackupLSN for these database backup files (Database setup script) into an Excel spreadsheet as shown below. The full scripts to retrieve the LSNs from all backup files are found at the end of this tip.

"Column A" is the backup type performed at a point-in-time (i.e. F1 = first full backup, T3 = third transaction log backup, D2 = second differential backup).

The full scripts to retrieve LSNs from all backup files are found at the end of this tip. “Column A” is backup type performed at a point-in-time.

Some attributes for the full database backup LSNs are:

  •  The very first full database backup will always have a DatabaseBackupLSN of zero
  •  The very first full database backup's FirstLSN will be the same as the CheckpointLSN

Some attributes of a differential database backup LSNs are:

  • The DatabaseBackupLSN value for the differential backup identifies the full database backup that is required in order to apply the differential database backup
  • The DatabaseBackupLSN value for the differential backup will match its base full database backup CheckpointLSN
  • The CheckpointLSN maps to the CheckpointLSN of the first transaction log backup after the differential backup

Some attributes of a transaction log backup LSNs are:

  • A LSN uniquely identifies every record in a transaction log backup
  • The FirstLSN and CheckpointLSN of the first transaction log backup is also the first full database backup CheckpointLSN if the backup is taken when the database is idle and no replication is configured
  • The transaction log LSN chain is not affected by a full or differential database backup
  • LSN are sequential in nature. A higher LSN value indicates a later point in time

Understanding LSN Mapping Examples in SQL Server

Below are 3 sections that describe the LSN mapping for:

  • Full database backup LSN to Transaction Log backup LSN
  • Full database backup LSN to Differential database backup LSN
  • Differential database backup LSN to Transaction Log backup LSN

Full database backup LSN to Transaction Log backup LSN

Full database backup LSN – Transaction Log backup LSN
  • FirstLSN identifies the first log record included in the backup
  • LastLSN includes log records up to, but not including this LSN
  • When planning which transaction log backup to use to roll forward, the LastLSN + 1 of the Full database backup will fall in between the FirstLSN and LastLSN of its subsequent transaction log backup
  • In the example above, Full database backup LastLSN 34000000025600001 falls in between transaction log backup T1 FirstLSN 34000000016000100 and LastLSN 34000000028800000. Applying T1 after F1 will succeed, applying T2 or T3 after F1 will result in an error.
  • A transaction log backup's LastLSN is the FirstLSN in the subsequent transaction log backup chain. In the example above, transaction log backup T1 LastLSN 34000000028800000 is the FirstLSN of transaction log backup T2, transaction log backup T2 LastLSN 34000000030400000 is the FirstLSN of transaction log backup T3 and so on

Full database backup LSN to Differential database backup LSN

Full database backup LSN - Differential database backup LSN
  • A differential database backup can only be applied ONCE to a restored full database backup that has a CheckpointLSN value that is equal to the differential backup DatabaseBackupLSN

Differential database backup LSN to Transaction Log backup LSN

Differential database backup LSN – Transaction Log backup LSN
  • A differential backup LastLSN + 1 will be in between the FirstLSN and LastLSN of its subsequent transaction log backup
  • In the example above, Full database backup LastLSN 34000000035200001 falls in between transaction log backup T3 FirstLSN 34000000030400000 and LastLSN 34000000036000000. Applying T3 after D1 will succeed, applying T4 or another transaction log backup will result in an error.

Script to Retrieve Backup LSNs

This is the full script to retrieve the LSNs for all database backup files created from this tip.

USE [master]
RESTORE HEADERONLY FROM DISK = N'C:\Temp\F1.BAK'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T1.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T2.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\D1.BAK'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T3.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T4.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\D2.BAK'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T5.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\F2.BAK'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T6.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T7.TRN'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\D3.BAK'
RESTORE HEADERONLY FROM DISK = N'C:\Temp\T8.TRN'
Next Steps



Posted by 보미아빠
, |


securable.zip


bios 에서 vt-x 를 enable 해도 위 첨부 파일로 조사시 Hardware Virtualization 이 No 로 나타나면 virtual box 가 동작하지 않는다. 그러므로, 아래 명령어로 hyper-v 를 disable 하고 리부팅 한다. 



Hypwer V 가 enable 되어 있으면 Oracle Virtual Box 가 동작하지 않는 이슈가 있음 ㅠ.ㅠ


Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All


Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All




Posted by 보미아빠
, |

기본 요구 사항 


* sql virtual account

* 설치 미디어 (edition 상관없음)  

* 혼합모드면 sa 암호


sqlserver virtual account 가 필요함 (삭제 했으면 다시 복구할 것)

이 계정이 없으면 sp 설치시 실패 한다. 

첨부된 powershell 로 복구 시도하고 추가로 더 설치한 서비스가 있으면 알아서 계정 추가하고 스크립트로 하던지 regedit 로 하던지 편한 방법으로 복구 



AccountRecovery.zip




설치 미디어 다운받기 위한 ie 설정 혹은 wget 윈도 버전으로 설치해서 하면 됨 


http://faq.hostway.co.kr/Windows_ETC/2504

http://care.dlservice.microsoft.com/download/7/5/1/751DF8B3-1430-4B6F-A2E1-3679D77AA39C/1042/SQLFULL_KOR.iso?lcid=1042






기존 edition 과 상관없이 evaluation 같은 버전을 하나 준비(압축 풀어야지요...)

우리는 sql server 2008 r2 이므로 이런곳에서 다운 받는다 


  • http://care.dlservice.microsoft.com/download/7/5/1/751DF8B3-1430-4B6F-A2E1-3679D77AA39C/1042/SQLFULL_KOR.iso?lcid=1042

서버레벨 변경만 상세설명


설치 미디어가 있는 폴더로 이동합니다. 

cmd 모드에서 디렉토리 레터를 확인해 이동합니다. 

d: 


collation 을 변경하기위해서 아래 명령과 비슷하게 입력합니다. 

Setup /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="WIN-FGPDFE2BQJD\Administrator" /SAPWD=P@ssw0rd /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS



Setup /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="cnc6-collation2\Administrator" /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS 



각각의 옵션은 https://msdn.microsoft.com/ko-kr/library/dd207003(v=sql.105).aspx 에 잘 설명되어 있습니다. 

간단하게 설명드리면 

INSTANCENAME : 인스턴스 이름을 확인합니다. 

확인하는 쿼리는 아래와 같습니다. 


select @@SERVICENAME;


SQLSYSADMINACCOUNTS : sysadmin role 을 가지고 있는 windows 계정을 입력합니다. 


SAPWD : sa 암호 입니다. 

Authentication Mode 가 윈도우와 SQL 을 동시에 사용하는 경우 반드시 입력해야 합니다. 

입력하지 않으면 알수없는 오류가 발생하고 전체 프로세스가 실패 합니다. 

이러한 모드를 확인하는 쿼리는 다음과 같습니다. 


윈도우 sysadmin role 만 있으면 sql sa 암호는 알아서 작업하면 되지 시스템 데이터베이스 리빌딩 스크립트 작업하는 사람이 귀찮아서 입력한 암호로 로그인 해보고 이상 없으면 sa 를 입력받은 암호로 다시 만들게 작업한 보양 입니다. -_- 이자슥들 암호 몰라도 값은 만들어 넣을수 있는거 다 알낀데...짜슥......


SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly')   

WHEN 1 THEN 'Windows Authentication'   

WHEN 0 THEN 'Windows and SQL Server Authentication'   

END as [Authentication Mode];


SQLCOLLATION : 원하는 collation 을 입력합니다. 

지원 가능한 전체 collation 을 확인하는 쿼리는 다음과 같습니다. 


SELECT name, description

FROM fn_helpcollations();


성공적으로 작업이 완료되면 아무 메시지가 없이 명령 프롬프트로 돌아갑니다. 

확인은 C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Logs 아래 폴더에서 로그를 읽어 확인하거나 

ssms 에서 다음 명령어를 입력합니다. 


SELECT CONVERT (varchar, SERVERPROPERTY('collation'));



이 때 edition 이나 서비스팩은 기존 에디션과 서비스팩(sp3)은 잘 적용되어 있는것을 확인함


나머지 매뉴얼은 아래를 참고 할 것


서버레벨 변경은 https://msdn.microsoft.com/en-us/library/ms179254(v=sql.105).aspx

데이터베이스 레벨 https://msdn.microsoft.com/en-us/library/ms175835(v=sql.105).aspx

컬럼 레벨 https://msdn.microsoft.com/en-us/library/ms190920(v=sql.105).aspx

Posted by 보미아빠
, |

excel loading

카테고리 없음 / 2016. 2. 16. 18:16

USE [master]

GO



EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1

GO


EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1

GO


use [a2d_test_login_server_01]

go


exec sp_configure 'show advanced options', 1

reconfigure with override 

go


exec sp_configure 'Ad Hoc Distributed Queries', 1 

reconfigure with override 

go



exec sp_configure 'Ad Hoc Distributed Queries'

go


--파일닫고 

select identity(int, 1,1) idx, * into result 

from OPENROWSET(

 'Microsoft.ACE.OLEDB.12.0'

 , 'Excel 12.0; HDR=YES; IMEX=1; Database=C:\a2d\result\output_login_server2.xlsx'

 , 'SELECT * FROM [aaa$a1:w]')



-- 파일이 열려 있을 때

메시지 7399, 수준 16, 상태 1, 줄 27

연결된 서버 "(null)"의 OLE DB 공급자 "Microsoft.ACE.OLEDB.12.0"에 오류가 발생했습니다. 공급자에서 오류에 관한 정보를 주지 않았습니다.

메시지 7303, 수준 16, 상태 1, 줄 27

연결된 서버 "(null)"에 대한 OLE DB 공급자 "Microsoft.ACE.OLEDB.12.0"의 데이터 원본 개체를 초기화할 수 없습니다.


Posted by 보미아빠
, |

도색

카테고리 없음 / 2016. 2. 11. 17:35

음 10년된 차 쪼메 수리해야 하는데

목감IC 랑 원효대사가 유명하군....


원효대사

http://blog.naver.com/bubblychoi/220131495434

http://map.daum.net/?panoid=1033191968&pan=347.9&tilt=-2.6&zoom=0&map_type=TYPE_MAP&map_attribute=ROADVIEW&q=%EC%9B%90%ED%9A%A8%EB%8C%80%EA%B5%90&urlX=486511&urlY=1117809&urlLevel=3


목감 IC

http://nadesicoc.egloos.com/v/5014173

Posted by 보미아빠
, |

미션 

여러 프로시저가 있는데 하나만 동작하게 만들어라 

CREATE DATABASE APPLOCKTEST

GO


USE APPLOCKTEST

GO



IF OBJECT_ID ('TBLX') IS NOT NULL

DROP TABLE TBLX

GO

IF OBJECT_ID ('USP_A') IS NOT NULL

DROP PROC USP_A

GO


-- 테스트 테이블

CREATE TABLE TBLX 

(IDX INT IDENTITY(1,1)

,C1 INT)

GO


-- 심심풀이 데이터

INSERT INTO TBLX (C1) VALUES (1)

GO


-- 실제로 일하는 프로시져

CREATE PROC USP_A 

(@V INT)

AS


WAITFOR DELAY '00:00:7'

INSERT INTO TBLX (C1) VALUES (@V)

GO









-- 동시에 실행하면 안되는 여러 프로시저들.....

IF OBJECT_ID('USP_JOB_EXEC_USP_A') IS NULL

EXEC ('CREATE PROC USP_JOB_EXEC_USP_A AS SELECT 1 ')

GO 


ALTER PROC USP_JOB_EXEC_USP_A

(

  @V INT = 1 

, @RESULT_CODE NVARCHAR(2000) OUTPUT 

)

AS


DECLARE 

  @LOCK_STATUS INT = 0 

, @RETRYS INT = 3 -- 1초에 한번씩 실행된다. 이걸로 조절하세요~

, @KEYWORD NVARCHAR(100) = '결산'

, @CURRENT_RETRY INT = 0


SET @RESULT_CODE = N'SUCCESS'


WHILE (@CURRENT_RETRY <= @RETRYS) 

BEGIN 


SELECT @LOCK_STATUS = APPLOCK_TEST('PUBLIC', @KEYWORD,'Exclusive', 'SESSION')


IF (@LOCK_STATUS <> 0 )

BEGIN 

EXEC SP_GETAPPLOCK @KEYWORD, 'EXCLUSIVE', 'SESSION'


-- SP_START

EXEC USP_A @V

SELECT 'AAAAAAAAAAAAAAAAAAA'

-- SP_END 


EXEC SP_RELEASEAPPLOCK @KEYWORD, 'SESSION'

BREAK;

END 

ELSE 

BEGIN 

IF @CURRENT_RETRY = @RETRYS

SET @RESULT_CODE = 'JOB CANCELED BY LOCK ' + @KEYWORD

ELSE 

WAITFOR DELAY '00:00:01'

SET @CURRENT_RETRY = @CURRENT_RETRY + 1 

END 

END 

GO










-- 동시에 실행하면 안되는 여러 프로시저들.....

IF OBJECT_ID('USP_JOB_EXEC_USP_B') IS NULL

EXEC ('CREATE PROC USP_JOB_EXEC_USP_B AS SELECT 1 ')

GO 


ALTER PROC USP_JOB_EXEC_USP_B

(

  @V INT = 1 

, @RESULT_CODE NVARCHAR(2000) OUTPUT 

)

AS


DECLARE 

  @LOCK_STATUS INT = 0 

, @RETRYS INT = 3 -- 1초에 한번씩 실행된다. 이걸로 조절하세요~

, @KEYWORD NVARCHAR(100) = '결산'

, @CURRENT_RETRY INT = 0


SET @RESULT_CODE = N'SUCCESS'


WHILE (@CURRENT_RETRY <= @RETRYS) 

BEGIN 


SELECT @LOCK_STATUS = APPLOCK_TEST('PUBLIC', @KEYWORD,'Exclusive', 'SESSION')


IF (@LOCK_STATUS <> 0 )

BEGIN 

EXEC SP_GETAPPLOCK @KEYWORD, 'EXCLUSIVE', 'SESSION'


-- SP_START

EXEC USP_A @V

SELECT 'AAAAAAAAAAAAAAAAAAA'

-- SP_END 


EXEC SP_RELEASEAPPLOCK @KEYWORD, 'SESSION'

BREAK;

END 

ELSE 

BEGIN 

IF @CURRENT_RETRY = @RETRYS

SET @RESULT_CODE = 'JOB CANCELED BY LOCK ' + @KEYWORD

ELSE 

WAITFOR DELAY '00:00:01'

SET @CURRENT_RETRY = @CURRENT_RETRY + 1 

END 

END 

GO







-- APPLICATION LOCK TEST CODE 


-- SESSION 1 

DECLARE @RESULT_CODE NVARCHAR(2000)

EXEC USP_JOB_EXEC_USP_A 5, @RESULT_CODE = @RESULT_CODE OUTPUT 

SELECT @RESULT_CODE



-- SESSION 2 

DECLARE @RESULT_CODE NVARCHAR(2000)

EXEC USP_JOB_EXEC_USP_B 5, @RESULT_CODE = @RESULT_CODE OUTPUT 

SELECT @RESULT_CODE



Posted by 보미아빠
, |

sql 2014 patch

카테고리 없음 / 2016. 2. 2. 19:44

http://blogs.sqlsentry.com/team-posts/latest-builds-sql-server-2014/

Posted by 보미아빠
, |

takeown /f c:\folder /r /d y

icacls c:\folder /grant Administrators:F /t


Posted by 보미아빠
, |

iPhone 6 LTE 폰에서 3G 데이터무제한 쓰기


왜?

1) 무제한 데이터를 싸게 쓰자는거지 머...

2) 3G 요즘 쓰는사람 거의없어서 대역폭이 남아돔

3) 집 화장실 불 켤 때 0.1초만에 켜지나 0.01초 만에 켜지나 나는 별 상관하지 않는다

   (충분히 만족할만한 속도라는 말이다. 그런데, 10배 빠르잖아 광고 팍팍!!)



1) 준비물

  스카치테이프
  (iPhone 4는 큰 USIM 인데, 손재주 좋으면 스카치 테이프이면 충분하고 아니면 usim 어뎁터가 있어야 함)

, USIM 뽑기용 핀

, 3G 전용 핸드폰 (KT/iPhone4 나 뭐 아무거나, 기존통신사와 같아야하고 36000 i밸류는 KT에만 있는듯)

2) iPhone6 USIM -> iPhone4에 잠깐 옮겨 단다 (쓰고있는 친구폰이면 충분함)

3) iPhone4 리부팅

4) 114 에 전화걸어 요금제 변경 상담원 연결 (9시 ~ 6시)

5) i밸류 데이터무제한 36000원 선택

6) 요금제 바뀌면 원래쓰던 LTE USIM을 iPhone6 자기폰에 꼽고 쓰면 끝


여담 1)

114 상담원들 이런거 잘 모르는척 함

LTE USIM 과 3G USIM 이 따로 있고, 3G USIM 을 따로 구매해야 한다고 안내함 (아님!)

USIM 은 사이즈 구분만 있고 3G LTE 이런거 구분 없음

(상담원한테 LTE 3G 전파부터 달라요 그래서 다시 구매 해야 합니다. <-- 졸라 짜증난 목소리로 이리 안내 받음, 걸림 뒤진다....너...)

공기계가 있어야 한다고 함 (아님, 쓰고있는 친구폰이면 충분함)


여담 2)

KT 는 가족 3명이 뭉치면 집 인터넷 무료임


여담 3)

ㅈㄹ 좋음~ 버스타고 유투브 빵빵하게 볼 수 있음 (안 끊어짐)

웹서핑 잘됨


여담 4)

1일 75메가 넘으면 QoS 걸린다는 루머가 있으나, 하루에 130메가 이상써도 안걸리고 잘 됨

한곳에서 주구장창 받으면 QoS 건다는 소문이 있음

이때는 기지국 옮기면 잘 된다는 소문이 있으나 위 3개다 아직 ..경험 해보지 못하고 잘 쓰고 있음



숙이 때문에...못살겠다...정말....


Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함