반응형
  1. /**********************************************************************************************
    -- Title : [2k] 데이터베이스 옵션 설정 및 확인
    -- Reference : dbRang.com
    -- Key word : databasepropertyex, sp_dboption,
    **********************************************************************************************/

    -- 데이터베이스 옵션 정보 확인하기
    SELECT DATABASEPROPERTYEX('northwind','isautoupdatestatistics')
    GO

    EXEC sp_dboption 'northwind', 'auto update statistics'
    GO

    SELECT DATABASEPROPERTYEX('northwind','Recovery')
    GO

    -- 설정 가능한 항목 보기(설정된 값을 보이는것 아님)
    EXEC sp_dboption            
    GO

    -- 해당 DB의 설정 항목 보기
    EXEC sp_dboption 'northwind'

    -- 자동 통계 업데이트 확인 및 변경
    SELECT DATABASEPROPERTYEX('pubs', 'IsAutoUpdateStatistics')
    GO

    -- 복구 모델 변경
    ALTER DATABASE model
    SET AUTO_UPDATE_STATISTICS OFF
    ,   RECOVERY BULK_LOGGED
    GO

    -- UserAccess 확인 및 변경
    SELECT DATABASEPROPERTYEX ('Northwind', 'UserAccess')
    GO

    --Single_user 설정
    ALTER DATABASE Northwind
    SET SINGLE_USER          --// 10초 후에 완료되지 않은 트랜잭션들을 롤백
    WITH ROLLBACK AFTER 10
    GO

    --Multi_User 설정
    ALTER DATABASE Northwind
    SET MULTI_USER
    GO

    -- DB OFFLINE 설정
    ALTER DATABASE Northwind
    SET OFFLINE
    GO

    -- 데이터베이스 옵션 종류(sp_dboption 확인)
      .. Auto create statistics
      .. Auto update statistics
      .. Autoclose
      .. Autoshrink
      .. ANSI null default
      .. ANSI nulls
      .. ANSI padding
      .. ANSI warnings
      .. Arithabort
      .. concat null yields null
      .. cursor close on commit
      .. Dbo use only
      .. default to local cursor
      .. merge publish
      .. numeric roundabort
      .. Offline
      .. Published
      .. quoted identifier
      .. read only
      .. Recursive triggers
      .. select into/bulkcopy
      .. single user
      .. Subscribed
      .. Torn page detection
      .. trunc. Log on chkpt.

    -- 데이터베이스 옵션 종류(databasepropertyex 확인)
      .. Collation
      .. IsAnsiNullDefault
      .. IsAnsiNullsEnabled
      .. IsAnsiPaddingEnabled
      .. IsAnsiWarningsEnabled
      .. IsArithmeticAbortEnabled
      .. IsAutoClose
      .. IsAutoCreateStatistics
      .. IsAutoShrink
      .. IsAutoUpdateStatistics
      .. IsCloseCursorsOnCommitEnabled
      .. IsFulltextEnabled
      .. IsInStandBy
      .. IsLocalCursorsDefault
      .. IsMergePublished
      .. IsNullConcat
      .. IsNumericRoundAbortEnabled
      .. IsPublished
      .. IsQuotedIdentifiersEnabled
      .. IsRecursiveTriggersEnabled
      .. IsSubscribed
      .. IsTornPageDetectionEnabled
      .. Recovery
      .. SQLSortOrder
      .. Status
      .. Updateability
      .. UserAccess
      .. Version

반응형

+ Recent posts