Drupal on IIS with SQL Server
Upcoming SlideShare
Loading in...5
×
 

Drupal on IIS with SQL Server

on

  • 3,658 views

Drupal 7 provides great support for SQL Server as a backend and there are a lot of reasons why you'll like this combination. This webcast starts by showing you how to install a Drupal 7 web site with ...

Drupal 7 provides great support for SQL Server as a backend and there are a lot of reasons why you'll like this combination. This webcast starts by showing you how to install a Drupal 7 web site with a SQL Server Express backend in a few clicks with WebPi and then discusses how to create and manage databases, logins and users using SQL Server Management Studio (SSMS) and the command line (SQLCMD).

Statistics

Views

Total Views
3,658
Views on SlideShare
3,657
Embed Views
1

Actions

Likes
1
Downloads
16
Comments
0

1 Embed 1

http://shackleb.wordpress.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Drupal on IIS with SQL Server Drupal on IIS with SQL Server Presentation Transcript

  • Drupal on IIS with aSQL Server database Alessandro Pilotti @alexpilotti MVP ASP.NET / IIS MCSD, MCAD, MCSE, MCDBA, MCT Red Hat Certified Engineer
  • SQL Server and Drupal Drupal offers the option to choose the database backend  No more limited to MySQL Drupal 7 provides great support for SQL Server 2008  All major modules nowadays use PDO and portable SQL  Works as well with SQL Server 2008 R2 and 2012 MS provides a PHP PDO driver for SQL Server There’s a free Express edition  Limited to 10GB per database SQL Azure
  • SQL Server for MySQL devs / admins SQL Server is a relational database like MySQL You can write SQL queries (SELECT, INSERT, UPDATE DELETE)  Like for every other DBMS there are some tricky differences  E.g. MySQL is more forgiving in the GROUP BY clause Management tools:  Management Studio  sqlcmd.exe View slide
  • Edition comparison Express (free)  Contains everything you need for the average Drupal site  Limited to 10GB database size, 1GB memory, 1 socket / 4 cores Web Standard Enterprise Feature comparison charts:  http://msdn.microsoft.com/en-us/library/cc645993.aspx View slide
  • SQL Server useful features Online backup (included also in express edition!)  Full  Differential  Log Replication  Min. standard edition, web and express only as subscribers Mirroring  Min. standard edition Log shipping  Min. web editition Great profiling tools  UI tools in standard edition
  • Instances You can install multiple isolated instances on the same server Only one can be the default unnamed instance All the others are named It means that you connect to the server with a name:  E.g. yourserverSQLEXPRESS
  • Databases SQL Server instances, like MySQL, contain multiple databases Every Drupal site has usually a separate database  Or you can use table_prefix of course Databases can be moved to different instances  detached from one  Attached to the other Databases can be put individually offline
  • Authentication Login  Credentials needed to connect to the instance  Windows account (integrated)  No password, best security approach  SQL server (mixed mode)  Classic username and password  Instance wide roles can be assigned to logins Database users  Specific to each database  Logins are mapped to database users  Object level (table, etc) permissions are granted to users Roles  A collection of permissions  Users can be assigned to roles
  • Main database roles db_owner  Can do everything on the database (not the instance!) db_datareader  Can run SELECT on any table / view db_datawriter  Can run INSERT, UPDATE, DELETE db_ddladmin  Can run any DDL command (CREATE, DROP, etc)
  • How to create a database Very easily with Management Studio Via command line: sqlcmd –S .SQLEXPRESS –E create database drupal7 create login drupal7 with password = Passw0rd’ go use drupal7 go create user drupal7 for login drupal7 exec sp_addrolemember db_owner, drupal7 go
  • Drupal 7 site with SQL Server using WebPi With just a few click using WebPi  Add also:  SQL Server 2008 R2 Management Studio Express with SP1
  • Drupal 7 site with SQL Server w/o WebPi Create web site Download and install SQL Server PDO driver:  http://www.microsoft.com/en- us/download/details.aspx?id=20098 Enable PHP extensions php_sqlsrv and php_pdo_sqlsrv  Drush @drupal7 dl sqlsrv  cd your_drupal_site_path  xcopy /i sitesallmodulessqlsrvsqlsrv includesdatabasesqlsrv
  • Database management Schedule proper backup policy  With or without transaction log Schedule maintenance tasks  Update statistics  Reindex  Shrink database
  • Backup policy Schedule a proper backup policy, e.g.:  Full database backup every night  Log every 5’ (or more, depending on your db)  This way you will not lose more than 5’ of data! To be able to backup the transaction log, set the database recovery model to  Full or Bulk-Logged  Default is Simple
  • Backup Use Management Studio or BACKUP DATABASE [drupal7] TO DISK = Nc:backupdrupal7_backup.bak WITH INIT, NAME = Ndrupal7-Full Database Backup’ Store backups on a remote file share!  To do that run the SQL service with an ad hoc user  Create the same user on the server with the network share
  • Set recovery model Management Studio (very easy) T-SQL (e.g. sqlcmd): USE [master] GO ALTER DATABASE [drupal7] SET RECOVERY FULL WITH NO_WAIT
  • How to schedule a backup The express edition of SQL Server doesn’t have a UI to schedule backups and other tasks We can use the windows scheduler to schedule:  Full backup every night  Log backup every 5’  Delete of old backups every nightschtasks.exe /create /tn drupal7_db_backup_full /tr "sqlcmd -S.SQLExpress -E -i c:backupdrupal7_backup_full.sql" /sc DAILY /ruAdministrator /rp /st 02:00:00 Useful task commands:  schtasks.exe /run /tn drupal7_db_backup_full  schtasks.exe /delete /tn drupal7_db_backup_full
  • To schedule a log backup E.g.: every 15’:  schtasks.exe /create /tn drupal7_dbbackup_log /tr "sqlcmd -S .SQLExpress -E -i c:backupdrupal7_backup_log.sql" /sc MINUTE /MO 15 /ru administrator /rp
  • Restore a database Best done via Management Studio Or manually (here’s a complete sample):  RESTORE DATABASE [drupal7] FROM DISK = Nc:backupdrupal7_backup_full_2012_05_15_14_53_06_470.bak WITH FILE = 1, NORECOVERY  GO  RESTORE DATABASE [drupal7] FROM DISK = Nc:backupdrupal7_backup_diff_2012_05_15_14_53_09_867.bak WITH FILE = 1, NORECOVERY  GO  RESTORE LOG [drupal7] FROM DISK = Nc:backupdrupal7_backup_log_2012_05_15_14_53_13_913.trn WITH FILE = 1, NORECOVERY  GO  RESTORE LOG [drupal7] FROM DISK = Nc:backupdrupal7_backup_log_2012_05_15_14_53_15_200.trn WITH FILE = 1  GO