Monday, November 07, 2011

Install SQL Server 2008

Một phương pháp cài đặt rất thú vị, cách cài đặt này giúp chúng ta giảm rất nhiều thời gian cho cho việc cấu hình cài đặt bằng cách tao một file configure_sql2008.ini chưa các tham số cài đặt và file setup_sql2008.bat để khởi động việc cài đặt.
2 file này được copy chung vào một thư mục với bộ cài hoặc tùy chỉnh theo đường dẫn mà các bạn cài đặt bộ cài và 2 file này. Với tôi, tôi ghi chung vào một đĩa và mount vào ổ Z:
File setup_sql2008.bat




::------------------------------------------------------------
:: SQL 2008 R2 Installation Script:: v1.1 03 July 2010
:: Developed by FIS : Hoang Dinh Khien (KhienHD@fpt.com.vn)
:: Objectives:
:: Dated: 01/11/2011
::------------------------------------------------------------
@echo
off
FOR /F "usebackq" %%i IN (`hostname`) DO SET hostname=%%i IF "%1"=="" GOTO Error
IF /I "%hostname%\Administrator"=="%1" GOTO ok
echo
Server cai dat chua dung hoac go sai ten Server
exit /B
:OK
z:
:: Install base SQL Server 2008 Enterprise

echo Installing base SQL Server 2008 R2...
"z:\setup.exe" /SAPWD=1qazXSW@ /CONFIGURATIONFILE=z:\configure_sql2008.ini /INDICATEPROGRESS /SQLSYSADMINACCOUNTS="%1"
:: Configure Windows Server 2008/R2 auditing policyauditpol /set /subcategory:"application generated" /success:enable /failure:enable
:: Remove left-over SQL 2008 entry from the start menu
rmdir "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SQL Server 2008" /q /s


exit /B
:Error
echo Phai dien thong tin dang : Z:\setup_sql2008.bat Hostname\Adiministrator



File file configure_sql2008.ini


Phần FEATURES có thể cài các chức năng mong muốn bằng cách điền vào dòng này.





;------------------------------------------------------------
; SQL SERVER 2008 R2 Configuration File
; Version 1.0, 5 May 2010
; Developed by FIS : Hoang Dinh Khien (KhienHD@fpt.com.vn)
; Objectives:
; Dated: 01/11/2011
;------------------------------------------------------------

[SQLSERVER2008]
; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.


INSTANCEID="QND"

; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.
ACTION="Install"
; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.
;FEATURES=SQLENGINE,RS,BIDS,CONN,BC,SDK,BOL,SSMS,ADV_SSMS,SNAC_SDK
FEATURES=RS,SQLENGINE,BIDS,TOOLS,CONN,SSMS,ADV_SSMS,IS
;FEATURES=RS,SQLENGINE,REPLICATION,FULLTEXT,AS,BIDS,CONN,IS,BC,SDK,BOL,SSMS,ADV_SSMS,SNAC_SDK,OCS
;FEATURES=RS
ROLE=AllFeatures_WithDefaults
; Displays the command line parameters usage
HELP="False"
; Specifies that the detailed Setup log should be piped to the console.
INDICATEPROGRESS="False"
; Setup will not display any user interface.
QUIET="False"
; Setup will display progress only without any user interaction.
QUIETSIMPLE="True"
; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.
X86="False"
; Specifies the path to the installation media folder where setup.exe is located.
MEDIASOURCE="Z:\"
; Detailed help for command line argument ENU has not been defined yet.
ENU="True"
; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI.
; UIMODE="Normal"
; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.
ERRORREPORTING="False"
; Specify the root installation directory for native shared components.
INSTALLSHAREDDIR="F:\Microsoft SQL Server"
; Specify the root installation directory for the WOW64 shared components.
INSTALLSHAREDWOWDIR="F:\Microsoft SQL Server (x86)"
; Specify the installation directory.
INSTANCEDIR="F:\Microsoft SQL Server"
; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.
SQMREPORTING="False"
; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).
INSTANCENAME="QND"
; Agent account name
AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Auto-start service after installation.
AGTSVCSTARTUPTYPE="Automatic"
; Startup type for Integration Services.
ISSVCSTARTUPTYPE="Automatic"
; Account for Integration Services: Domain\User or system account.
ISSVCACCOUNT="NT AUTHORITY\NetworkService"
; Controls the service startup type setting after the service has been created.
ASSVCSTARTUPTYPE="Automatic"
; The collation to be used by Analysis Services.
ASCOLLATION="Latin1_General_CI_AS"
; The location for the Analysis Services data files.
ASDATADIR="F:\Microsoft SQL Server\MSAS10_50.QND\OLAP\Data"
; The location for the Analysis Services log files.
ASLOGDIR="F:\Microsoft SQL Server\MSAS10_50.QND\OLAP\Log"
; The location for the Analysis Services backup files.
ASBACKUPDIR="F:\Microsoft SQL Server\MSAS10_50.QND\OLAP\Backup"
; The location for the Analysis Services temporary files.
ASTEMPDIR="F:\Microsoft SQL Server\MSAS10_50.QND\OLAP\Temp"
; The location for the Analysis Services configuration files.
ASCONFIGDIR="F:\Microsoft SQL Server\MSAS10_50.QND\OLAP\Config"
; Specifies whether or not the MSOLAP provider is allowed to run in process.
ASPROVIDERMSOLAP="1"
; A port number used to connect to the SharePoint Central Administration web application.
FARMADMINPORT="0"
; Startup type for the SQL Server service.
SQLSVCSTARTUPTYPE="Automatic"
; Level to enable


FILESTREAM feature at (0, 1, 2 or 3).
FILESTREAMLEVEL="0"

; Set to "1" to enable RANU for SQL Server Express.
ENABLERANU="False"

; Specifies a Windows collation or an SQL collation to use for the Database Engine.
SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"

; Account for SQL Server service: Domain\User or system account.
SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Default directory for the Database Engine user databases.
;SQLUSERDBDIR="F:\Microsoft SQL Server\MSSQL\Data"

; Default directory for the Database Engine user database logs.
;SQLUSERDBLOGDIR="F:\Microsoft SQL Server\MSSQL\Data\Logs"

; Directory for Database Engine TempDB files.
;SQLTEMPDBDIR="F:\Microsoft SQL Server\MSSQL\Data"

; Directory for the Database Engine TempDB log files.
;SQLTEMPDBLOGDIR="F:\Microsoft SQL Server\MSSQL\Data\Logs"

; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express.
ADDCURRENTUSERASSQLADMIN="False"

; Specify 0 to disable
or 1 to enable the TCP/IP protocol.TCPENABLED="1"

; Specify 0 to disable or 1 to enable the Named Pipes protocol.


NPENABLED="0"

; Startup type for Browser Service.


BROWSERSVCSTARTUPTYPE="Automatic"

; Specifies how the startup mode of the report server NT service. When
; Manual - Service startup is manual mode (default).
; Automatic - Service startup is automatic mode.
; Disabled - Service is disabled
RSSVCSTARTUPTYPE="Automatic"

; Specifies which mode report server is installed in.
; Default value: “FilesOnly”
RSINSTALLMODE="FilesOnlyMode"

; Accept SQL Server 2008 R2 license terms
IACCEPTSQLSERVERLICENSETERMS="TRUE"

; The default is Windows Authentication. Use "SQL" for Mixed Mode Authentication.

SECURITYMODE="SQL"



Nếu bạn cũng muốn ghi ra đĩa và mount và ổ Z, muốn thư mục cài trỏ vào ổ F: thì chỉ việc copy nguyên đoạn 2 đoạn scrip trên về sử dụng :D

No comments:

Post a Comment