It’s me

October 20, 2009

Oracle XE Tuning

Filed under: Uncategorized — rothmans @ 5:17 pm

오라클 XE 버전은 간단하고 쉽게 데이터베이스 작업을 시작할 수 있습니다. 그러나 기본 설정에서 몇가지를 확장할 필요성이 있습니다.

데이터베이스 세션

한번에 핸들할 수 있는 데이터베이스 세션 수를 증가합니다.  데이터베이스에 보다 많은 사용자의 접근이 가능하게 합니다
 

sqlplus /nolog
SQL> show parameters sessions
SQL> alter system set sessions=250 scope=spfile;

 
데이터베이스를 재시작하세요.

 

데이터베이스 프로세스

한번에 실행하는 데이터베이스 프로세스를 증가합니다. 데이터베이스에 보다 많은 사용자의 접속을 가능하게 합니다.

sqlplus /nolog
SQL> show parameters processes
SQL> alter system set processes=200 scope=spfile;

데이터베이스를 재시작하세요.

ORA-12516: TNS:리스너가 프로토콜 스택과 일치하는 처리기를 찾을 수 없습니다

Filed under: XE — rothmans @ 4:49 pm

Korean: ORA-12516: TNS:리스너가 프로토콜 스택과 일치하는 처리기를 찾을 수 없습니다
English: ORA-12516, TNS:listener could not find available handler with matching protocol stack

다음 파일에서 굵게 표시된 부분으로 수정합니다
c:\oraclexe\app\oracle\product\10.2.0\server\config\scripts

##############################################################################
# Copyright (c) 1991, 2005, Oracle. All rights reserved.
##############################################################################

###########################################
# Cursors and Library Cache
###########################################
open_cursors=300

###########################################
# Database Identification
###########################################
db_name=XE

###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=c:\oraclexe\app\oracle\admin\XE\bdump
core_dump_dest=c:\oraclexe\app\oracle\admin\XE\cdump
user_dump_dest=c:\oraclexe\app\oracle\admin\XE\udump

###########################################
# File Configuration
###########################################
control_files=(“c:\oraclexe\oradata\XE\control.dbf”)

###########################################
# Job Queues
###########################################
# job_queue_processes=4
job_queue_processes=10

###########################################
# Miscellaneous
###########################################
compatible=10.2.0.1.0

###########################################
# Processes and Sessions
###########################################
sessions=20

###########################################
# SGA Memory
###########################################
sga_target=768M

###########################################
# Security and Auditing
###########################################
audit_file_dest=c:\oraclexe\app\oracle\admin\XE\adump
remote_login_passwordfile=EXCLUSIVE

###########################################
# Shared Server
###########################################
dispatchers=”(PROTOCOL=TCP) (SERVICE=XEXDB)”
shared_servers=4

###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=256M

###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=AUTO
undo_tablespace=UNDO

###########################################
# Backup and Recovery
###########################################
DB_RECOVERY_FILE_DEST_SIZE = 10G
DB_RECOVERY_FILE_DEST = c:\oraclexe\app\oracle\flash_recovery_area

os_authent_prefix=”"

July 14, 2009

SQL Server – 중복되는 레코드 삭제

Filed under: SQL SERVER — rothmans @ 2:50 pm

다음 코드는 중복되는 레코드를 삭제할 때 유용하다. 반드시 테이블은 identity 컬럼을 가져야 하며 중복되는 레코드를 판단하는 기준이된다. 이 예제에서 IDX는 identity 컬림이며, 중복을 확인할 필드명은 dup_col1, dup_col2, dup_col3 이다.


DELETE FROM MyTABLE
WHERE IDX NOT IN
(
SELECT MAX(IDX)
FROM MyTABLE
GROUP BY dup_col1, dup_col2, dup_col3
)

June 25, 2009

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

Filed under: SQL SERVER — Tags: , — rothmans @ 3:16 pm

Visual Studio 2008과 Visual Studio 2008 Express Edition을 사용하고, ASP.NET의 App_Data 에 MDF 파일을 사용하려고 할때 다음과 같은 에러 메시지가 발생하는 경우가 있습니다

“사용자 인스턴스의 프로세스를 시작하지 못했기 때문에 SQL Server의 사용자 인스턴스를 생성하지 못했습니다. 연결이 닫힙니다.”

“Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.”

web.config 내용

<add name=”ConnectionString” connectionString=”Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDB.mdf;Integrated Security=True;User Instance=True” providerName=”System.Data.SqlClient”/>
 

해결방법
다음 폴더를 삭제합니다. 삭제 후 재시도 하면 폴더가 재생성되고 MDF 파일 및 로그등이 생성됩니다

C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

April 29, 2009

Previous releases of Microsoft Visual Studio 2008

Filed under: SQL SERVER — rothmans @ 1:54 pm

Microsoft SQL 2008을 설치할 때 다음과 같이 Visual Studio 2008 SP1 을 요구하는 메시지가 표시됩니다.

규칙 “Microsoft Visual Studio 2008의 이전 릴리스 확인”
이 컴퓨터에 Microsoft Visual Studio 2008의 이전 릴리스가 설치되어 있습니다. SQL Server 2008을 설치하기 전에 Microsoft Visual Studio 2008을 SP1으로 업그레이드하십시오.

Rule “Previous releases of Microsoft Visual Studio 2008″ failed.
A previous release of Microsoft Visual Studio 2008 is installed on this computer. Upgrade Microsoft Visual Studio 2008 to the SP1 before installing SQL Server 2008.

Visual Studio 2008 SP1 이 설치되어 있어야 하나, 다음과 같은 방법으로 설치가 가능합니다.

Setup /ACTION=install /SkipRules=VSShellInstalledRule RebootRequiredCheck

이 방법은 문서화되어 있지는 않지만, VSShellInstalledRule 을 체크하는 부분을 Skip 함으로써 설치가 가능하게 합니다

April 8, 2009

IDE 상태에서 실행중인지 확인

Filed under: Visual Basic — Tags: — rothmans @ 1:32 pm

첫번째 방법)

Option Explicit

Private Sub Form_Load()
   Debug.Print RunningIDE
End Sub

Private Function RunningIDE() As Boolean
    Debug.Assert Not TestIDE(RunningIDE)
End Function

Private Function TestIDE(Test As Boolean) As Boolean
    Test = True
End Function

두번째 방법)

Public Function RunningCompiledCode() As Boolean
   On Error Resume Next
   Debug.Print 1 / 0
   RunningCompiledCode = (Err.Number = 0)
   Err.Clear
End Function

March 18, 2009

마지막 글자 제거

Filed under: C# — rothmans @ 1:57 pm

str.Substring(0, str.Length - 1);

February 25, 2009

SELECT * INTO {TARGET} FROM {SOURCE}

Filed under: SQL SERVER — rothmans @ 1:29 pm

- 새로운 테이블 생성, 전체 컬럼 INSERT
SELECT * INTO {TARGET} FROM {SOURCE}

- 새로운 테이블 생성, 일부 컬럼 INSERT
SELECT * INTO {TARGET}
  FROM (
                  SELECT COLUMN1, COLUMN2 FROM {SOURCE}
                ) AS TMP_TBL

- 기존 테이블 이용, 전체 컬럼 INSERT
INSERT INTO {TARGET} SELECT * FROM {SOURCE}

- 기존 테이블 이용, 일부 컬럼 INSERT
INSERT INTO {TARGET} SELECT COLUMN1, COLUMN2 FROM {SOURCE}

December 9, 2008

지정한 기간내의 일자 목록

Filed under: SQL SERVER — rothmans @ 5:35 pm

declare @todate varchar(10)
declare @frdate varchar(10)
declare @cudate varchar(10)
declare @dtdiff int
declare @cnt int

if object_id (‘tempdb..#tempx’) is not null drop table #tempx
create table #tempx (idx int identity (1,1), cudate varchar(10))

set @frdate = ‘2008-12-30′
set @todate = ‘2009-01-02′
set @cnt = 0
set @dtdiff = datediff(day, convert(datetime, @frdate), convert(datetime, @todate))

while @cnt <= @dtdiff
begin
set @cudate = convert(varchar(10), dateadd(day, @cnt, convert(datetime, @frdate)), 120)
insert into #tempx (cudate) values (@cudate)
set @cnt = @cnt + 1
end

select * from #tempx

간단한 임시 테이블 사용 Stored procedure

Filed under: SQL SERVER — Tags: , , , — rothmans @ 10:45 am

create procedure temporay_table_test
as
begin
declare @frdate datetime
declare @cnt int
create table #tempx (idx int identity (1,1), frdate datetime)

set @cnt = 1
while @cnt < 5
begin
waitfor delay ‘00:00:01′ — 시간 delay
set @frdate = getdate()
set @cnt = @cnt + 1
insert into #tempx (frdate) values (@frdate)
end
select * from #tempx
end

if object_id (‘tempdb..#tempx’) is not null drop table #tempx

Older Posts »

Blog at WordPress.com.