Hướng dẫn học Microsoft SQL Server 2008 part 13 ppt

10 378 0
Hướng dẫn học Microsoft SQL Server 2008 part 13 ppt

Đang tải... (xem toàn văn)

Thông tin tài liệu

Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 82 Part I Laying the Foundation FIGURE 4-1 The SQL Server Installation Center is the launch point for numerous planning, set-up, and advanced options. Setup Support Rules and Support Files pages The first step of the installation, shown in Figure 4-2, checks the current configuration and status of the server to ensure that it’s capable of a SQL Server installation. Pressing OK, assuming the server passed all the tests, launches the Setup Support Files installation. This page simply installs all the support files needed for the SQL Server installation. When the setup support files are installed, SQL Server Setup will rerun the Setup Support Rules. This time it performs additional checks to ensure that the support files and components installed into the OS properly. Installation Type page The Installation Type page simply allows you to choose to install a new installation or modify the feature set of an existing SQL Server instance. Product Key and License Terms pages As the name implies, the Product Key page is used to authenticate your license of SQL Server or choose to install a free edition — Evaluation Enterprise Edition, Express Edition, or Express Edition with Advanced Services. Copies downloaded from MSDN often have the product key supplied automatically. The License Terms page has the obligatory and ubiquitous ‘‘I accept the license terms’’ check box. 82 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 83 Installing SQL Server 2008 4 FIGURE 4-2 The Setup Support Rules page ensures that the server complies with the rules, or requirements, for setup. In this case, which is very common, my server has a pending reboot from a previous installation or Windows upgrade. Feature Selection page The Feature Selection page, shown in Figure 4-3, presents a tree view of the possible components and services. Selected by default are the shared components, Books Online, and the client tools. The real choice here is whether to install the relational Database Engine Services and its options, Replication and Integrated Full-Text Search; or Analysis Services; or Reporting Services. A common error o n this page is to forget to select Full-Text Search. Depending on the services selected, additional pages may be added to the rest of the setup process. Instance Configuration page This page is used to select a default or named instance and provide a name for the named instance (up to 16 characters), as well as to configure the instance ID, and specify the file path of the instance root directory. Disk Space Requirements page The Disk Space Requirements page simply informs you of the disk requirements for the selected compo- nents and ensures that the server has enough space to continue setup. 83 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 84 Part I Laying the Foundation FIGURE 4-3 Use the Feature Selection page to select the major services and components to install. Server Configuration page This page supplies server options for the Database Engine component. Here is where the Windows service account is configured so that SQL Server will have permission to execute and access to files. Also configured on this page is the initial startup type, which determines whether the services start auto- matically when Windows starts or whether they require manual starting. A common error on this page is to miss the Collation tab on this page. The default is probably OK for most installations, but be careful that you don’t miss this important step. Database Engine Configuration page There are three tabs on the Database Engine Configuration page: Account Provisioning, Data Directories, and Filestream. Account Provisioning configures SQL Server to only accept users based on their Windows account or mixed mode, which also allows SQL Server-defined users. If mixed mode is selected, then the SA 84 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 85 Installing SQL Server 2008 4 account must be created with a strong P@s$w0rD. Windows authenticated accounts may also be added on this page and automatically added to the server sysadmin role. Securing databases is discussed in more detail in Part VII: ‘‘Security.’’ The Directories tab is used to configure the default directories for user database and transaction log files, the tempdb database and transaction log file, and the default backup directory. The Filestream tab is where Filestream is enabled for the server. If there’s any chance you might want to try any sample code that runs in AdventureWorks2008 (like nearly all of Books Online and much of the code in this book), then enable Filestream. AdventureWorks2008 can’t be installed without Filestream enabled for the server. Analysis Services Configuration page This optional page, which appears only if Analysis Services was selected in the Feature Selection page, is used to add initial users with administrative permission and configure the default directories for Analysis Services. Reporting Services Configuration page If Reporting Services was selected in the Feature Selection page, this page is used to select the native configuration or SharePoint c onfiguration. Error and Usage Reporting page The Microsoft SQL Server team really does use this information to collect usage statistics on SQL Server features and error reports. This information is key to determining where the team’s efforts should be invested. Please enable these options. Installation Rules and Ready to Install pages This rendition of the Rules page verifies the installation configuration. The Ready to Install page reports the complete configuration in a tree view, and the location of the created .ini file with these configura- tion options. Clicking the Install button will launch the actual installation. Unattended installations SQL Server 2008 continues its tradition of offering the capability to perform an unattended installation based on an .ini configuration file. A well-commented sample .ini file, template.ini, can be found at the root of the SQL Server installation CD. This file contains the [Options] section, which must be customized for the type of installation to perform. The clear-text installation .ini file does not provide any security for logins and passwords that are embedded. Take appropriate measures to restrict access to this file if it contains logins and passwords. The following example command shows the syntax for starting an unattended installation: setup.exe /settings <full path to .ini file> 85 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 86 Part I Laying the Foundation For example, to install SQL Server with the settings specified in an .ini file named mySQLSettings .ini located in a SQLTemp folder in the root of the system drive, the following command would be executed: setup.exe /settings c:\SQLTemp\mySQLSettings.ini The following command-line switches affect installation behavior: ■ /qn performs a silent installation with no dialogs. ■ /qb displays only progress dialogs. Once an installation configuration file has been created, it can be used for either an unattended installa- tion or even a remote installation. Remote installations SQL Server 2008 may be installed on a remote network computer. A remote installation begins with the same configuration .ini file that an unattended install uses, but adds three additional values in the remote configuration .ini file, as described in Table 4-5. Remote installation can be performed only in a domain environment, not on a workgroup computer. TABLE 4-5 Remote Install Required .ini Options Option Description TargetComputer The network computer name on which SQL Server will be installed AdminAccount The admin user account of the target server where SQL Server will be installed AdminPassword The password for the admin user account of the target server Upgrading from Previous Versions SQL Server 2008 includes upgrade support for SQL Server 2000 and 2005. Prior to any upgrade, run the Upgrade Advisor to determine any effects the upgrade may have. Microsoft supports installing SQL Server 2008 over an installation of SQL Server 2000 or 2005, but I strongly recommend that you use a side-by-side upgrade process. This method begins with a fresh installation of SQL Server 2008 on a newly set up Windows Server box and then moves any user databases to the new server using either backup/restore, or detach/attach. This method is also excellent for testing the new configuration prior to the actual production go-live date. 86 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 87 Installing SQL Server 2008 4 Upgrading from SQL Server 2005 The Database Engine, Migration Analysis Services, Reporting Services, and Integration Services may all be upgraded to SQL Server 2008. While some of these components may co-reside, others may not. Table 4-6 illustrates how the components may be installed. TABLE 4-6 Component Upgrade Types Server Component Side-by-Side Upgraded Migration Required Database Engine Yes Yes No Migration Analysis Services Yes Yes Yes Reporting Services No Yes 11 Yes 22 Notification Services No No Yes 33 Data Transformation Services Yes Yes Yes 1 The upgrade is transparent when on a default installation with no modifications. 2 When installing to a modified/non-default installation. Otherwise, migration is not required. 3 Migration occurs after the 2005 Database Engine and Notification Services have been installed. If access to SQL Server 2000 components and data is required, then installing SQL Server 2005 side-by- side with the 2000 installation is the way to go. When upgrading SQL 2000 servers, upgrade the client and target database servers first to ensure minimal data failures of the primary servers. Migrating to SQL Server During the data life cycle there are distinct points when the conversion to a new database proves beneficial and provides value. During these nexuses, a determination of the new database’s features, requirements, value, and business needs must be made. Should enough evidence support the migration, then time-consuming projects begin to translate the data, schemas, and business logic to the new database. Aware of the time and cost inherent in these activities, Microsoft has provided the SQL Server Migration Assistant (SSMA), coinciding with the release of SQL Server 2005, to aid in migrations from alternative databases. Migrating from Access Microsoft and other third-party vendors provide upsizing wizards that are intended to port a database from MS Access to SQL Server. Avoid these at all costs. I’ve never seen a smooth automatic migration from Access to SQL Server. The best practices and common design patterns for Access translate into worst practices for SQL Server. 87 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 88 Part I Laying the Foundation The only route is to analyze the Access schema, create a new fresh schema in SQL Server, build out appropriate stored procedures, and then port the data to SQL Server. Migration Assistant The initial release of SSMA includes support for migrating from Oracle to SQL Server 2000. SSMA pro- vides a significant step forward in determining the complexity of a database project at a fraction of the cost and time associated with traditional determination means. Schema, data, constraint, migration, and validation can be accomplished through the new IDE. All migrations go through the following phases: assessment, schema conversion, data migration, business logic conversion, validation, integration, and performance analysis. Assessment SSMA provides an assessment that includes an estimate of the labor required and provides information on what can be migrated automatically versus manually. Approximately 100 statistics are provided to characterize the database and offer insight into the complexity. SSMA also provides an estimate regarding the hours required to manually accomplish the conversion tasks. While SSMA provides faster insight into the complexity of the database, it will still take time to identify the complexity of client software at the application and middle-tier levels. Schema conversion After it is connected to a source Oracle and target SQL database, the IDE displays the various attributes and objects of the databases. The source PL/SQL can be viewed along with the converted T-SQL for comparison. The IDE supports direct editing of the displayed SQL. Oracle system functions that do not have a counterpart in SQL will be supported through the use of additional UDFs and stored procedures. Constraints, views, and indexes will all convert to their corre- sponding entities on SQL Server. Data migration The Oracle schema can be automatically converted to the SQL Server schema, and all specified data migrated to the SQL Server database. During migration, the administrator must be aware of possible constraints, triggers, and other dependencies that could prevent the record insertions, on a per-table basis, from completing. Business logic conversion Table 4-7 illustrates the conversions that take place from PL/SQL to SQL Server. Transactions in SQL Server can be implicit by using SET IMPLICIT_TRANSACTIONS ON,or explicit by using BEGIN TRAN and COMMIT TRAN. If exceptions are disabled on the target SQL Server, then no exception handling will occur. If exception handling is enabled, then exceptions are converted using IF/GOTO statements and UDFs. 88 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 89 Installing SQL Server 2008 4 TABLE 4-7 PL/SQL to T-SQL Conversions PL/SQL T-SQL Outer (+) joins ANSI-standard outer joins Hints Supported hints include First_Rows, Index, Append, Merge_Aj, Merge_Sj, Merge Unsupported hints will be ignored. Boolean Smallint String parameters with unspecified length Varchar(8000) Numeric parameters with unspecified length and precision Numeric (38,10) Functions User-defined functions (UDFs) Triggers Before After Row-level Multiple Triggers Instead Of After Emulated using cursors Combined into one Package functions UDFs using PackageName _ FunctionName convention Package procedures Stored procedures using PackageName _ ProcedureName convention Package variables Emulated with a table and support functions System functions System functions or UDFs If-Elsif. . .Elsif-Else-End Nested IF statements NULL SYSDB.SYS.DB_NULL_STATEMENT Case Case Goto Goto Loop with Exit or Exit When While (1=1) with a Break While While For While Cursors With parameters FOR loop Close cursor_name Cursors Multiple cursors Cursor with local variables Close cursor_name and Deallocate cursor_name 89 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 90 Part I Laying the Foundation TABLE 4-7 (continued ) PL/SQL T-SQL Return Return Comments Comments Variables Static with %Type with %Rowtype Records Variables Resolved at conversion time Group of local variables Group of local variables Procedure calls Procedure calls Function calls Function calls Begin Tran Commit Rollback Begin Tran Commit Rollback SavePoint Save Transaction Exceptions Emulated in T-SQL Validation and Integration The IDE provides a view of the SQL, similar to a code tool that displays differences between the source and newer versions of code, and supports the capability to modify, accept, and/or discard the proposed changes. Additional synchronization options include being able to overwrite the database objects with the current workspace objects, overwrite the workspace objects from the database, and merge objects. Removing SQL Server To remove SQL Server, use the Add/Remove Programs option in the Windows Control Panel. If there are multiple instances, removing a single instance will leave the other instances intact and a ble to function. User databases will not b e deleted by the uninstall and their directory structure remains intact. Detaching and copying a database to another server prior to removing an instance of SQL Server enables continued access to the data. If that is not possible, back up and restore the database to another server or attach the orphaned database to another server. 90 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 91 Installing SQL Server 2008 4 Summary SQL Server 2008 is easy to install with proper planning, With the 2008 release, Microsoft has intro- duced additional tools to aid in migration and configuration, and refined existing tools to assist with the install and upgrade paths. Default installations continue to be straightforward, and a little planning and forethought will help for installations that deviate from the fresh install. Following the ‘‘secure by default’’ philosophy, SQL Server 2008 disables the bulk of its features, especially for fresh installs. Enabled features prior to an upgrade remain enabled once 2008 has been installed. If you’ve had painful upgrade experiences in the past, be hopeful — I’ve heard nothing but good stories about SQL Server 2008 upgrades. With SQL Server installed, the next chapter moves on to connecting clients to SQL Server. 91 www.getcoolebook.com . 87 Installing SQL Server 2008 4 Upgrading from SQL Server 2005 The Database Engine, Migration Analysis Services, Reporting Services, and Integration Services may all be upgraded to SQL Server 2008. While. another server. 90 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 91 Installing SQL Server 2008 4 Summary SQL Server 2008 is easy to install with proper planning, With the 2008. UDFs. 88 www.getcoolebook.com Nielsen c04.tex V4 - 07/23/2009 1:58pm Page 89 Installing SQL Server 2008 4 TABLE 4-7 PL /SQL to T -SQL Conversions PL /SQL T -SQL Outer (+) joins ANSI-standard outer joins Hints Supported hints

Ngày đăng: 04/07/2014, 09:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan