Microsoft SQL Server
This guide covers SQL Server setup, configuration, and management for Microsoft Dynamics NAV and related systems.
Overview​
SQL Server is the database engine used by Microsoft Dynamics NAV and LS Central. Proper SQL configuration is essential for system performance, reliability, and data integrity.
Key Areas:
- SQL Server installation and setup
- Database configuration
- Performance optimization
- Backup and maintenance
- Security configuration
Prerequisites​
Before setting up SQL Server, ensure you have:
- ✅ Windows Server with appropriate permissions
- ✅ SQL Server installation media
- ✅ Required licenses
- ✅ Administrative access
- ✅ Network connectivity
- ✅ Understanding of system requirements
Installation​
Step 1: Prepare Server​
-
System Requirements
- Windows Server 2016 or later
- Minimum 8GB RAM (16GB+ recommended)
- Sufficient disk space for databases
- Network connectivity
-
Pre-Installation Checks
- Verify system requirements
- Check available disk space
- Review security policies
- Plan installation location
Step 2: Install SQL Server​
-
Run Installation
- Launch SQL Server installation wizard
- Select installation type
- Choose features to install
-
Configuration
- Set instance name
- Configure service accounts
- Set up authentication mode
- Configure ports
-
Complete Installation
- Review configuration
- Install SQL Server
- Verify installation
- Use dedicated service accounts for SQL Server services
- Enable Windows Authentication mode
- Configure appropriate memory limits
- Set up proper file locations for data and logs
Database Configuration​
Creating Databases​
-
Create NAV Database
CREATE DATABASE [NAV_Database]
ON (NAME = 'NAV_Data', FILENAME = 'C:\SQLData\NAV_Data.mdf')
LOG ON (NAME = 'NAV_Log', FILENAME = 'C:\SQLLog\NAV_Log.ldf'); -
Configure Database Settings
- Set recovery model
- Configure file growth
- Set initial sizes
- Configure auto-shrink (if needed)
Database Settings​
| Setting | Recommended Value | Description |
|---|---|---|
| Recovery Model | Full | Enables point-in-time recovery |
| Auto Growth | Enabled | Allows database to grow automatically |
| Auto Shrink | Disabled | Prevents performance issues |
| Compatibility Level | Latest | Use latest SQL Server features |
Performance Optimization​
Index Management​
-
Create Indexes
CREATE INDEX idx_Customer_Email
ON Customers(Email); -
Maintain Indexes
- Regular index maintenance
- Rebuild fragmented indexes
- Update statistics
- Monitor index usage
Query Optimization​
- Use appropriate indexes
- Avoid SELECT * queries
- Use parameterized queries
- Monitor slow queries
- Optimize joins and WHERE clauses
Regularly monitor query performance, index usage, and database statistics to maintain optimal performance.
Backup & Recovery​
Backup Strategy​
-
Full Backups
- Schedule daily full backups
- Store backups securely
- Test restore procedures
- Document backup locations
-
Transaction Log Backups
- Schedule frequent log backups
- Maintain log chain
- Monitor log file size
- Configure retention policy
Backup Configuration​
-- Full backup
BACKUP DATABASE [NAV_Database]
TO DISK = 'C:\Backups\NAV_Full.bak'
WITH COMPRESSION, INIT;
-- Transaction log backup
BACKUP LOG [NAV_Database]
TO DISK = 'C:\Backups\NAV_Log.trn'
WITH COMPRESSION;
Regularly test backup restoration procedures to ensure backups are valid and can be restored when needed.
Security Configuration​
Authentication​
-
Windows Authentication
- Use Windows authentication when possible
- Configure service accounts
- Set up domain integration
-
SQL Authentication
- Use strong passwords
- Enable password policies
- Limit SQL logins
- Regular password rotation
User Permissions​
-
Principle of Least Privilege
- Grant minimum required permissions
- Use role-based access
- Regular permission audits
- Document access changes
-
Database Roles
- Assign appropriate database roles
- Use custom roles for specific needs
- Review role memberships regularly
Maintenance​
Regular Maintenance Tasks​
-
Index Maintenance
- Rebuild fragmented indexes
- Update statistics
- Monitor index usage
- Remove unused indexes
-
Database Maintenance
- Check database integrity
- Shrink log files (if needed)
- Update statistics
- Clean up old data
Maintenance Plans​
Create automated maintenance plans for:
- Backups - Automated backup schedules
- Index Maintenance - Regular index optimization
- Statistics Updates - Keep statistics current
- Integrity Checks - Verify database integrity
Monitoring​
Key Metrics​
Monitor the following SQL Server metrics:
- CPU Usage - Server processor utilization
- Memory Usage - SQL Server memory consumption
- Disk I/O - Database file I/O performance
- Query Performance - Slow query identification
- Connection Count - Active database connections
Tools​
- SQL Server Management Studio (SSMS) - Primary management tool
- Activity Monitor - Real-time performance monitoring
- SQL Profiler - Query tracing and analysis
- Performance Dashboard - Performance metrics
Troubleshooting​
Common Issues​
| Issue | Solution |
|---|---|
| Connection Errors | Check SQL Server service, verify network, check firewall |
| Performance Issues | Review indexes, check statistics, optimize queries |
| Disk Space | Monitor database growth, implement data archiving |
| Backup Failures | Verify disk space, check permissions, review backup location |
Diagnostic Queries​
-- Check database size
EXEC sp_spaceused;
-- Check active connections
SELECT * FROM sys.dm_exec_sessions;
-- Check index fragmentation
SELECT * FROM sys.dm_db_index_physical_stats(
DB_ID(), NULL, NULL, NULL, 'DETAILED');
Best Practices​
Configuration​
- ✅ Use appropriate recovery model
- ✅ Configure proper file growth settings
- ✅ Set up automated maintenance
- ✅ Monitor database size and growth
- ✅ Regular performance tuning
Security​
- ✅ Use Windows authentication when possible
- ✅ Implement strong password policies
- ✅ Regular security audits
- ✅ Limit administrative access
- ✅ Encrypt sensitive data
Backup & Recovery​
- ✅ Regular automated backups
- ✅ Test restore procedures
- ✅ Store backups off-site
- ✅ Document recovery procedures
- ✅ Monitor backup success
Related Resources​
- Branch Server - Branch server setup
- NAV & LS Retail Setup - System setup guide
- Microsoft Dynamics - Dynamics overview
- Technical Documentation - Technical reference
Questions?​
For questions about SQL Server setup and configuration:
- Contact your Technical Team Lead
- Reach out to the Head of Software Department
- Check SQL Server documentation
- Review system administration guides
Need help? Don't hesitate to reach out! 🚀