Article ID: 22953 SQL Tuning and Maintenance for the Altiris Deployment Server express database. Question Now Deployment Server is installed how do I manage the express database? Topics that will be covered 1. Taskpad is a quick way to manage the express database. 2. How to schedule SQL backups. 3. How to restore a express database from backup.bak file. 4. How to set up alerts with SQL Agent and create jobs. 5. Create a Maintenance Plan (Recovery Models). 6. SQL DS\sa Users Accounts and Permissions. 7. Microsoft SQL 2005 32-bit and 64-bit Application. 8. Troubleshooting Altiris Deployment Server/Microsoft SQL KBs. Answer Taskpad* is a quick way to manage the express database. It allows you to create schedules, view properties, back up the database, and so on with few steps involved. Taskpad is disabled by default in full installations as well as disabled by default in desktop installations (MSDE). To enable or disable the Taskpad, open SQL Enterprise Manager by going to Start > Programs > Microsoft SQL Server > Enterprise Manager. Select and highlight the express database. Choose Taskpad from the View menu. Below are screenshots which demonstrates each view. There are three tabs located on the right pane window: see the screenshot below. General tab: View general information about the express database. Table Info tab: Lists the size of each table, rows, and so on. Wizards tab: Select many Wizards to administration. General tab: Here is general information about the express database. For example the Transaction log file should be below 20 megs. First Category illustrates quick views of Database: Owner Date Created 1
Size Space available Database options Number of users Second Category shows Maintenance: Last database backup Last differential backup Last Transaction log backup Maintenance plans Third Category shows Space allocated: Data MB size Transaction log space MB size With Taskpad, it is easier to scheduled backs up, verify the last backup, and set up Transaction log files settings. Select the yellow arrow next to the category. Right-click on the category to view options. Table Info tab: Shows general information about the express tables. Displays information about the Rows, Index Size, and Size (Screenshot not available) Wizards tab: Wizards will guide you through administration utilities. To create a Scheduled express back up for example: 2
First Category described in General: Register a SQL Server. Run SQL Profiler. Run SQL Query Analyzer. Books On-Line Second Category is Setup a Database During the Deployment Server install this has already been setup. Third Category is Manage SQL Server: Backup a Database Create an Alert Create a Job Copy database Index Tuning Create a Maintenance Plan Run SQL Profiler from Taskpad or highlight express database > Tools SQL Profiler File > Open > Trace Template Choose SQL Profiler Tuning. Select SQL Profiler Tuning > Open: 1. The first tab General > Save Trace As. 2. Select Events tab > Add events which need to be tracked. Run SQL Query Analyzer From Taskpad or express database > Tools > SQL Query Analyzer. Backup a Database How to schedule SQL backups: Highlight the express database > View Task Pad > highlight on Maintenance (Yellow Arrow) Scroll to Back up Database. Select to Schedule on the bottom portion of the General tab. Options Tab> Verify Backup. To Stop/Restart the Services with a batch file, create a Windows Task scheduler. Use Window Scheduler to run the batch file. You could build a batch file that you can run that uses the NET STOP and NET START commands. Syntax NET START service NET STOP service Gracefully reconnect Altiris Deployment Services is resolved in Deployment Server 6.8. For information on how to backup the express MSDE database, see article 19693. The MSDE Plus 3.4* utility is available on http://downloads-zdnet.com.com/3000-10257- 10245746.html. MSDE Plus is a fully featured tool for Microsoft Data Engine (MSDE) and Microsoft SQL 3
Server 7.0/2000 SQL users. Restoring a express database from backup.bak file. All Deployment Server services need to be stopped. Open Enterprise Manager > rightclick on the express database > All Tasks > Restore Database. On the General tab > Select to Restore from Device > Select the Devices button, then Restore from Disk and then Add. Browse to your express.bak file and click OK. Select OK twice more. It should state Restore Progress. SQL Server is currently in the process of restoring the backup set. If you receive an error stating "Exclusive access could not be obtained because the database is in use, make sure all Deployment Server Services have stopped. Restart the backup database. How to set up alerts with SQL Agent and create jobs The SQL Agent is located under the Management folder below the Database folder. SQL Server Agent: 4
Right-click on SQL Agent, scroll down to the Advance tab, and restart the Services for the SQL agent if they have stopped. Auto Restart the SQL Server if it stops unexpectedly and Auto restart the SQL Server Agent if it stops unexpectedly. There are three categories within SQL Server Agent configuration: Alerts : Right click to make new alerts. Operators: Net Send or e-mail. Jobs: View Jobs History: Create new jobs as well. 5
Creating a Maintenance Plan (Recovery Models) Select Create a Maintenance Plan wizard and verify the express database has a check box. Select Next. (These are options based on preference.): 1. Update data optimization information. 2. Database Integrity check 3. Specify the Database Backup Plan 4. Specify Backup Disk Directory 5. Specify the Transaction Log Backup Plan 6. Reports to Generate 7. Maintenance Plan History 8. Finish. For a database maintenance plan, utilize the wizard and select the following: 1. Select the express database. 2. Check Reorganize data and index pages. 3. Select Reorganize with the original amount of free space. 4. On the integrity check page, mark Check Database Integrity and select Include Indexes. There is an option to check "Attempt to Repair any minor problems," but keep in mind that for the repair to happen, the database needs to be able to go into Single-user mode; this means the database cannot be in use. 5. Specify a database backup plan, verify integrity, and perform once a day. Many back up to a disk and then have a generic tape drive grab the.bak file. If the user wishes to backup directly to tape, the tape drive needs to be physically attached to the SQL Server. 6. Decide how long to keep backups. 7. Decide the method for doing a transaction log backup. If running a Full recovery model, back up the transaction log at least twice a day. If running a Simple recovery model, the option to back up the transaction log is not available. 8. Again, user preference on how long to keep the backups. 9. Creating a report is up to user as well as maintaining history. 10. Give the maintenance plan a name to identify what it is for. There are three Recovery models: Bulk_Logged Recovery Model (By Default), Simple Recovery Model, and Full Recovery Model. If data is not critical, change to Simple. If you change to Full and set a limit size, you may receive warnings. Change Recovery Model To change Recovery Model, go to SQL Enterprise Manager, right-click on express database, select Properties, and then select the Options tab. 6
Jobs and Wizards: To Create a Transaction log file truncation job. Go to Tools > Wizards, and select Wizards and then Create Job Wizard. Select Job > Transact-SQL command. If the Database Name is set to Master, change it to express database. Paste the query into the white box and select Next. Then schedule a job. Make sure the SQL server agent is running (the Management folder in SQL Enterprise manager) and verify that the Job is created in the Management Folder. SQL DS\sa Users Accounts and Permissions See article 1399 to know what permissions are required for the Altiris express database. For connectivity issues with the SQL database go into the Data sources (ODBC) under administrative tools. Switch to the System DSN tab and configure the Altiris express Database. Go to Start > Run and type in ODBCAD32 or, to set the ODBC settings, go to Control Panel > ODBC, or Control Panel > Administrative Tools > ODBC, and select System DSN. Highlight the express database and select Configure. Make sure the configuration shows the correct SQL server and is pointing to the express database. Select Next. Three parts on authentication configuration. Two authentication modes> NT authentication and SQL. "How should SQL Server verify the authenticity of the login ID?" With NT authentication using the network ID. With SQL server authentication using a login ID and password entered by the user. By default With NT authentication using the network ID should be selected. The Client Configuration > Network Library > TCP/IP should be selected. Connect 7
to SQL Servers to obtain default settings for the additional configuration options. With SQL authentication selected the login ID and password can be edited. Select Next. At this point it will test the authentication login account. Select Next, Next again, and then click Finish on the wizard, Then click Test data source; if the test fails, check the configuration settings for the Altiris express Database. Add User to Altiris Deployment express database: Open SQL Enterprise Manager, select the express database and then User accounts. Right-click and click on New Database User. Add user s information. User should have Public and db_owner rights. DSDBSecurity.exe is a utility which is located in express\deployment Server\TechSup\Windows\DSDBSecurity.exe. DSDBSecurity can set role Permissions for the DS users and SQL users. When executed connect to SQL connection> {local}> Set Role permissions. Step 3 shows how to use the DSDBSecurity if the database has a custom name. Resetting the SA account password Open SQL Enterprise manager. Select Security and then Logins. 8
Name Type Server Access BUILTIN\Administrators Windows Group Permit sa Windows Group Permit Right-click on the SA account, and Properties and then type in the new password. Reprompt for a new password. Permit in Database roles should be db_owner and public roles. If Login failed for user sa, then it s because the user is not associated with a trusted SQL Server connection. In SQL Enterprise Manager, right-click on the SQL Server (Local) Windows NT. Scroll to Properties and select the Security tab. Make sure that Authentication is not Windows only. Select SQL and Windows authentication. If it is difficult for the server properties to come up then check how the server is registered in SQL Enterprise Manager. Right-click on the SQL server and edit the server s register properties. 9
Assigning Permissions to specific Roles within SQL Enterprise Manager > Security > Server Roles. There are three types of permissions. Grant Allows the user to work with data or execute specific Transact-SQL Statement. Revoke Removes a previously granted or denied permission. Deny Denies permission and prevents the user from inheriting the permission through other group or role memberships. The Best practice is to modify the rights and permissions in the DS console instead. Object Security 1. For Deployment Server Security Role Base here are a few references. Deployment Server 32-Bit Console > Tools > Security. 2. Right-click on a Group of computers, scroll to Permissions, and select the DS user. 3. Right-click on a job and go to Permissions. Create DS Users or AD import and only give them rights to the Group of computers (Not All Computers permissions) to Schedule jobs for example. To verify you have setup the right permissions> Log in as the New DS user and try to 10
drop a simple job on All Computers. You should receive the message below. For information on securing Deployment Solution 6.8, see article 27507. Microsoft SQL 2005 32-bit and 64-bit Application Note: The newest release of Microsoft SQL 2005*, the Enterprise Manager*, and SQL Query Analyzer* was replaced with SQL Server Management Studio*. The SQL Server Management Studio is a separate component install. TCP\IP and Named Pipes Protocol. E:\Program Files\Microsoft SQL Server\80\Tools\Binn Port 1433 is the Default Port. Select the Properties button. 11
The protocol must be enabled on both the client and server to work. The server can listen for requests on all enabled protocols at the same time. The protocols in the order listed in SQL Server Configuration Manager. 12
For SQL 2005 Client protocols > Root of SQL server Configuration Manager > SQL Network Configuration > Protocols names and status. If SQL server 2005 32-bit application is installed on a 64-bit Titanium this is unsupported. SQL server 2005 AMD is supported if the set to emulation mode. Verify SQLsvr.exe in Task manager running in 32-bit emulation. It will show a asterisk 32 next to the executable. http://msdn.microsoft.com/library/default.asp?url=/library/enus/win64/win64/wow64_implementation_details.asp SQL Server 2005 64-bit application running on a 64-bit operating system is supported as long as it connects through ODBC. Deployment Server 6.8 build does support 64-bit operating system. Troubleshooting Altiris Deployment Server/Microsoft SQL KBs If the express.ldf Transaction Log File grows to large, it is possible that it is not being truncated during your backups. If only manually backing up the express.mdf file for the database will not truncate the express.ldf file. To manually truncate the express.ldf file, follow the steps found in article 18018: Large.ldf Transaction log file. 13
Or if you are experiencing Deployment Server being slow, not responding, or hanging when trying to open the console; AClients disconnecting; or not being able to remote control, read article 4214, Deployment Server Engine, Client Connectivity, and Remote Control Troubleshooting Guide. This is caused in part by AClient settings and Transaction log file size. This article also includes Query to Truncate Transaction Log query on page 3. This article has a step-by-step process to move the database. Even though this is directed to the Altiris Database, the same steps can be found in article 20213, How to move an existing Altiris database from one SQL server to a new SQL server. After you reattach, use the ODBC Datasource to point to the new instance. System DSN tab. The following articles may also provide relevant information: 1317, The best optimization for SQL is to setup and use a maintenance plan for SQL 24559, What are the MSDE OSQL command lines 24561, How to clean out old machines in Deployment Server MSDE database? 18341, Additional details on SQL Express SQL Server Best Practices Analyzer http://www.microsoft.com/downloads/details.aspx?familyid=7e67d087-f098-49a9-8975-5b7290e3e2ba&displaylang=en Note: Subscribe to this article if you would like to receive updates. T The information contained in the Altiris knowledgebase is subject to the Terms of Use as outlined at http://www.altiris.com/legal/termsofuse.asp. 14