230 likes | 439 Views
SQL 101 for Dynamics NAV. Nick Haman. Agenda. SQL compared to C-Side Security Management and User Setup SQL Backup/Restore NAV/SQL Setup SQL Recommended Configuration SQL Management Studio basics Additional Information. SQL compared to C-Side. VSIFT vs. SIFT
E N D
SQL 101 for Dynamics NAV Nick Haman
Agenda • SQL compared to C-Side • Security Management and User Setup • SQL Backup/Restore • NAV/SQL Setup • SQL Recommended Configuration • SQL Management Studio basics • Additional Information
SQL compared to C-Side • VSIFT vs. SIFT • Backup Strategy • SQL allows for Point-in-Time recovery • SQL database allows for easier integration • SRS (SQL Reporting Services) • SQL Query • .NET Integration
SQL compared to Native • File size limitations on C-Side • Temp File size of 2GB is still a limitation on SQL • Native DB has limit of 256GB • Native database being removed in version 7
Security Mgmt. and User Setup • Enhanced Security Model • Uses individual application roles • Slower on sync due to recreation of application roles • Requires Security Sync run manually if: • Insert / Modify / Delete of Windows Login • Security Model change • Restore a backup
Security Mgmt. and User Setup • Convert a database • Update executable files • Update the application • Sync can be run per Login • Standard Security Model • Uses one application role • Runs sync automatically for Windows Logins • Run sync manually database restored • Standard is faster and easier to use
Security Mgmt. and User Setup • Security managed through Classic Client • Login • Database Login setup in SQL • Requires Security Sync in both Security Models • Windows Login created in database during Security Sync
SQL Backup/Restore • Recovery Model • Simple • All data in a database or filegroup is backed up • Can use Differential Backups between Full Backups • If restore needed, data is lost from last Full or Differential Backup to time of failure
SQL Backup/Restore • Full • Allows for Transaction Logs for Point-in-Time recovery • Can use Differential Backups between Full Backups • If restored needed, data only lost from last Log Backup to time of failure • Bulk-logged • Special-Purpose model for bulk inserting data
SQL Backup/Restore • SQL Backup • Full Backup • All data in a database or filegroup is backed up • Differential Backup • All data that has changed since last full backup • Transaction Log Backup • All log information since last Log Backup
SQL Backup/Restore • SQL Backup compared to NAV Backup • No separation of: • Companies • Common data • Application Objects
NAV/SQL Setup • Database Information (File>Database>Information) • Database • Database Name • sp_helpdb • Database Used (KB) • sp_spaceused • dbcc_updateuseagewill update sp_spaceused
NAV/SQL Setup • Alter Database (File>Database>Information) • General • Database Name • sp_helpdb • Database Files and Transaction Log Files • Logical Name • sp_helpdb • File Name; File Growth; Maximum Size • select physical_name from sys.database_files
NAV/SQL Setup • Collation • Collation Type/Collation Description • sp_helpsort • Options • Single User • EXEC sp_dboption ‘database name', 'single user', 'true‘ • EXEC sp_dboption ‘database name', 'single user', false‘
NAV/SQL Setup • Recovery Model • sp_helpdb • sp_dboption ‘database name' • Integration • Objects • Settings are all for Integration such as creating views on tables or modeling of foreign key relationships
NAV/SQL Setup • Advanced • Lock Timeout (File>Database>Alter Advanced tab) • Wait time if resource locked by another user • Set between 10-20 • select * from [$ndo$dbproperty] • Advanced • Always Rowlock (File>Database>Alter Advanced tab) • Holdover value for SQL 2000 32 bit • Most cases disable to free up lock memory
SQL Recommended Configuration • Auto Create Statistics – enable • Overhead is minimal • Important to SQL Query Plans • Auto Update Statistics – enable • Overhead is minimal • Important to C/AL for FIND operations • Still recommend SQL job periodically to update
SQL Recommended Configuration • Auto Grow – enable • Can create bottleneck and should only be used for emergency • Normally want to grow Data and Log manually during off peak hours by 10-25% • Database Compatibility Level • SQL Server 2008 or 2008R2 • Set to 100 (SQL Server 2008 level) • NAV uses OPTIMIZE FOR UNKNOWN query hint
SQL Recommended Configuration • Trace Flag 4136 • If NAV 2009 SP1 and Compatibility level 100 – this is not needed • Still can be good for other databases/applications • Disables parameter sniffing • Max Degree of Parallelism • Set to 1 to prevent Parallelism
SQL Recommended Configuration • Default Isolation Level • SERIALIZABLE by default • NAV 5.0 SP1/NAV 2009 SP1 Build 30482 and later • Can set to REPEATABLEREAD by updating $ndo$dbproperty table • NAV 2009 SP1 HF • Cursors changed to Dynamics FFO for Browse with OPTION (FAST x)
Additional Information • SQL Backups - Database Management • http://msdn.microsoft.com/en-us/library/ms187048.aspx • Database Properties • http://msdn.microsoft.com/en-us/library/ms188124.aspx • Blog Entry for SQL Server Recommendations • http://blogs.msdn.com/b/nav/archive/2010/09/28/microsoft-dynamics-nav-sql-server-configuration-recommendations.aspx