SQL Replication Extension for VS Code
Welcome to the SQL Replication Extension for Visual Studio Code! This extension makes it easy to manage SQL Server replication directly from your favorite IDE.
Features
- đ Set up and manage SQL Server replication
- đ Monitor replication status and health
- đ Create and modify publications and subscriptions
- đ Configure replication settings
- đ View detailed replication logs
- ⥠Quick actions for common replication tasks
Quick Start
- Install the extension from the VS Code marketplace
- Connect to your SQL Server instance
- Start managing your replication configuration
For detailed instructions, check out our Getting Started guide.
Why This Extension?
Managing SQL Server replication traditionally requires using SQL Server Management Studio or complex SQL scripts. This extension brings that functionality directly into VS Code, making it more accessible and integrated with your development workflow.
Requirements
- Visual Studio Code 1.60.0 or higher
- SQL Server 2016 or higher
- Appropriate permissions on your SQL Server instance
Support
Having issues? Check out our:
Contributing
We welcome contributions! See our Contributing Guide for details on how to get involved.
Getting Started
This guide will help you get up and running with the SQL Replication Extension for VS Code.
Installation
- Open VS Code
- Press
Ctrl+P
(Windows/Linux) orCmd+P
(macOS) - Type
ext install sqlrepl
- Click "Install"
Prerequisites
Before using the extension, ensure you have:
- SQL Server 2016 or higher installed
- Appropriate permissions to configure replication
- SQL Server Agent running on your instance
First Steps
-
Open the SQL Replication View
- Click the SQL Replication icon in the Activity Bar
- Or use the command palette (
Ctrl+Shift+P
) and type "SQL Replication: Show Explorer"
-
Add a Connection
- Click the "+" button in the SQL Replication view
- Enter your server details:
Server: your-server-name Authentication: SQL Server or Windows Username: your-username (if using SQL Server auth) Password: your-password (if using SQL Server auth)
-
Configure Distributor
- Right-click your server in the tree view
- Select "Configure Distribution"
- Follow the wizard to set up distribution
Next Steps
- Learn how to create publications
- Set up subscriptions
- Monitor your replication status
Troubleshooting
If you encounter any issues:
- Check the Output panel (
Ctrl+Shift+U
) and select "SQL Replication" from the dropdown - Verify SQL Server Agent is running
- Ensure you have appropriate permissions
- See our troubleshooting guide for more help
Need Help?
- Check our documentation
- File issues on GitHub
Installation
Basic Usage
Connecting to SQL Server
Managing Publications
This guide covers how to create and manage SQL Server replication publications using the SQL Replication Extension.
Understanding Publications
A publication is a collection of articles (tables, stored procedures, etc.) that you want to replicate to other databases. The SQL Replication Extension supports two types of publications:
- Snapshot Publications: Create a complete copy of all articles at a specific point in time
- Transactional Publications: Continuously replicate changes from the publisher to subscribers
Creating a Publication
-
Access the Publications View
- Expand your server in the SQL Replication view
- Right-click the "Publications" folder
- Select "Create Publication"
-
Configure Distribution If distribution isn't configured yet, the extension will guide you through setting it up:
- Choose a distribution database name (default: "distribution")
- Specify a working directory for snapshot files
- Configure security settings
-
Choose Publication Type Select either:
- Snapshot: For periodic full data synchronization
- Transactional: For continuous change replication
-
Name Your Publication
- Enter a unique name for your publication
- Select the database containing the articles to publish
-
Select Articles
- Choose the tables you want to replicate
- The extension automatically filters out system tables
Managing Existing Publications
Viewing Publications
- Expand your server in the SQL Replication view
- Open the "Publications" folder to see all publications
- Click on a publication to view its properties
Monitoring Status
- Check the status indicators next to each publication
- View agent jobs associated with the publication
- Access detailed agent history and logs
Common Tasks
- Start/Stop Agents: Use the play/stop buttons next to agent items
- View History: Click the history icon to see detailed agent logs
- Add Subscriptions: Right-click a publication to add subscribers
Best Practices
-
Naming Conventions
- Use descriptive names for publications
- Include the type (snapshot/transactional) in the name
- Consider including the database name for clarity
-
Performance Considerations
- Limit the number of articles to what's necessary
- Consider table size when choosing publication type
- Monitor snapshot folder disk space
-
Security
- Use Windows Authentication when possible
- Create dedicated service accounts for replication
- Regularly review permissions
-
Maintenance
- Monitor agent status regularly
- Set up alerts for failed jobs
- Keep snapshot folder clean
Troubleshooting
Common Issues
-
Publication Creation Fails
- Verify distribution is properly configured
- Check SQL Server Agent is running
- Ensure sufficient permissions
-
Snapshot Generation Issues
- Verify snapshot folder permissions
- Check available disk space
- Review agent job history
-
Article Access Errors
- Verify schema permissions
- Check for schema changes
- Review article properties
Getting Help
If you encounter issues:
- Check the Output panel for detailed error messages
- Review the troubleshooting guide
- Search or file issues on GitHub
Managing Subscriptions
This guide explains how to create and manage subscriptions to SQL Server replication publications using the SQL Replication Extension.
Understanding Subscriptions
A subscription defines how a database receives replicated data from a publication. The SQL Replication Extension supports two types of subscriptions:
- Push Subscriptions: The distributor pushes changes to subscribers
- Pull Subscriptions: Subscribers request changes from the distributor
Creating a Subscription
-
Access the Subscriptions View
- Expand your server in the SQL Replication view
- Either:
- Right-click a publication to subscribe to it
- Right-click the "Subscriptions" folder to browse available publications
-
Choose Subscription Type Select either:
- Push: Better for immediate synchronization, managed at publisher
- Pull: Better for occasional synchronization, managed at subscriber
-
Configure Database
- Select or create the subscriber database
- The database name can be different from the publisher
-
Set Synchronization Options Choose when to initialize the subscription:
- Immediate: Start synchronization right away
- Automatic: Wait for next snapshot
- Manual: Initialize later manually
-
Configure Security
- Choose authentication mode for remote connections
- Set up service account permissions if needed
Managing Existing Subscriptions
Viewing Subscriptions
- Expand your server in the SQL Replication view
- Open the "Subscriptions" folder
- Click a subscription to view its properties
Common Tasks
-
Reinitialize Subscription
- Right-click the subscription
- Select "Reinitialize"
- Choose synchronization options
- Monitor initialization progress
-
Monitor Status
- Check status indicators
- View agent job history
- Monitor synchronization progress
-
Drop Subscription
- Right-click the subscription
- Select "Drop Subscription"
- Confirm the removal
Best Practices
-
Subscription Planning
- Choose appropriate subscription type based on needs
- Consider network bandwidth and latency
- Plan for initialization time with large databases
-
Performance Optimization
- Monitor agent job performance
- Schedule initializations during off-peak hours
- Configure appropriate retry intervals
-
Security Considerations
- Use Windows Authentication when possible
- Create dedicated service accounts
- Regularly review permissions
-
Maintenance Tasks
- Monitor subscription status
- Check for synchronization delays
- Validate data consistency periodically
Troubleshooting
Common Issues
-
Initialization Failures
- Verify network connectivity
- Check permissions on both sides
- Review snapshot availability
-
Synchronization Delays
- Monitor distribution agent
- Check for blocking processes
- Verify agent job status
-
Security Errors
- Verify service account permissions
- Check network security settings
- Review firewall configurations
Getting Help
If you encounter issues:
- Check the Output panel for error messages
- Review agent job history
- See our troubleshooting guide
- File issues on GitHub
Monitoring Replication
This guide covers how to monitor SQL Server replication health and performance using the SQL Replication Extension.
Understanding Replication Agents
The extension helps you monitor different types of replication agents:
-
Snapshot Agent
- Creates initial data snapshots
- Runs periodically for snapshot publications
- Critical for initial synchronization
-
Log Reader Agent
- Monitors transaction log for changes
- Moves transactions to distribution database
- Essential for transactional replication
-
Distribution Agent
- Moves transactions from distributor to subscribers
- Handles data delivery and conflict resolution
- Key for maintaining synchronization
Monitoring Tools
Agent Status View
- Expand a server in the SQL Replication view
- Check agent status indicators:
- âļī¸ Running
- âšī¸ Stopped
- â ī¸ Failed
- đ In Progress
Agent History
- Click the history icon next to any agent
- View detailed execution logs:
- Run times
- Status messages
- Error details
- Duration information
Performance Monitoring
- Monitor agent execution times
- Track synchronization latency
- View error rates and patterns
Common Monitoring Tasks
Checking Agent Status
- Open the SQL Replication view
- Expand your server
- Look for status indicators
- Start/stop agents as needed
Viewing Job History
- Click the history icon
- Review recent executions
- Check for errors or warnings
- Analyze performance patterns
Troubleshooting Issues
- Check agent status
- Review error messages
- Examine job history
- Monitor system resources
Best Practices
Regular Monitoring
-
Check Agent Status Daily
- Verify all agents are running
- Look for warning signs
- Address issues promptly
-
Review Performance Metrics
- Monitor latency
- Check resource usage
- Track error rates
-
Maintain History
- Keep sufficient history
- Archive important logs
- Document issues and solutions
Setting Up Alerts
-
Agent Failures
- Monitor agent status
- Set up email notifications
- Define escalation procedures
-
Performance Issues
- Track synchronization delays
- Monitor resource usage
- Set thresholds for alerts
-
Error Patterns
- Look for recurring issues
- Track error frequencies
- Identify root causes
Troubleshooting
Common Issues
-
Agent Not Starting
- Check SQL Server Agent status
- Verify service account permissions
- Review error logs
-
Synchronization Delays
- Check network connectivity
- Monitor system resources
- Review agent job history
-
Performance Problems
- Check for blocking processes
- Monitor disk space
- Review network latency
Getting Help
If you need assistance:
- Check the Output panel for detailed logs
- Review our troubleshooting guide
- File issues on GitHub
Advanced Monitoring
Using System Views
The extension provides access to key system views:
- Distribution agent history
- Log reader agent history
- Snapshot agent history
- Replication performance metrics
Custom Monitoring
- Set up custom monitoring schedules
- Configure specific metrics to track
- Create custom alert thresholds
Performance Optimization
- Monitor resource usage
- Track synchronization times
- Identify bottlenecks
- Optimize agent schedules
Configuration
Troubleshooting
Best Practices
Command Reference
This guide lists all available commands in the SQL Replication Extension for VS Code. Commands can be accessed through:
- The Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) - Context menus in the SQL Replication view
- Toolbar buttons
Server Management
Add SQL Server Connection
- Command ID:
sqlrepl.addConnection
- Icon: â
- Description: Add a new SQL Server instance to manage replication
- Access:
- Command Palette
- SQL Replication view toolbar
- Options:
- Server name
- Authentication type (Windows/SQL)
- Credentials (for SQL authentication)
- Database name (optional)
Remove Server
- Command ID:
sqlrepl.removeServer
- Icon: đī¸
- Description: Remove a SQL Server connection from the extension
- Access: Server context menu
- Confirmation: Required before removal
Disable Publishing and Distribution
- Command ID:
sqlrepl.removeReplication
- Icon: đī¸
- Description: Remove all replication configuration from a server
- Access: Server context menu
- Confirmation: Required before removal
- Effects:
- Removes all publications
- Drops distribution database
- Disables distribution
Publication Management
Create Publication
- Command ID:
sqlrepl.createPublication
- Icon: â
- Description: Create a new replication publication
- Access: Publications folder context menu
- Options:
- Publication type (Snapshot/Transactional)
- Database selection
- Article selection
- Snapshot folder location
- Security settings
Subscription Management
Create Subscription
- Command ID:
sqlrepl.createSubscription
- Icon: â
- Description: Create a new subscription to a publication
- Access:
- Publication context menu
- Subscriptions folder context menu
- Options:
- Subscription type (Push/Pull)
- Subscriber database
- Synchronization options
- Security settings
Reinitialize Subscription
- Command ID:
sqlrepl.reinitializeSubscription
- Icon: đ
- Description: Reinitialize an existing subscription
- Access: Subscription context menu
- Options:
- Synchronization type
- Snapshot application
Drop Subscription
- Command ID:
sqlrepl.dropSubscription
- Icon: đī¸
- Description: Remove an existing subscription
- Access: Subscription context menu
- Confirmation: Required before removal
Agent Management
Start Agent
- Command ID:
sqlrepl.startAgent
- Icon: âļī¸
- Description: Start a replication agent job
- Access: Agent context menu (when stopped)
- Applies to:
- Snapshot Agent
- Log Reader Agent
- Distribution Agent
Stop Agent
- Command ID:
sqlrepl.stopAgent
- Icon: âšī¸
- Description: Stop a running replication agent job
- Access: Agent context menu (when running)
- Confirmation: Required before stopping
- Applies to:
- Snapshot Agent
- Log Reader Agent
- Distribution Agent
View Agent History
- Command ID:
sqlrepl.viewAgentHistory
- Icon: đ
- Description: View detailed agent job history
- Access: Agent context menu
- Information shown:
- Execution times
- Status
- Error messages
- Duration
- Step details
General Commands
Refresh View
- Command ID:
sqlrepl.refreshTree
- Icon: đ
- Description: Refresh the SQL Replication view
- Access:
- SQL Replication view toolbar
- Command Palette
- Updates:
- Server status
- Publication list
- Subscription status
- Agent status
Show Welcome Message
- Command ID:
sqlrepl.showWelcomeMessage
- Description: Display the extension's welcome message
- Access: Command Palette
- Content:
- Quick start guide
- Feature overview
- Documentation links
Keyboard Shortcuts
The extension uses VS Code's standard keyboard shortcut system. You can customize these in your keyboard shortcuts settings:
- Open Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
) - Type "Preferences: Open Keyboard Shortcuts"
- Search for "SQL Replication"
- Customize shortcuts as needed
Context Menu Reference
Different commands are available depending on the context:
Server Node
- Add Connection
- Remove Server
- Disable Publishing and Distribution
- Refresh
Publications Folder
- Create Publication
- Refresh
Publication Node
- Create Subscription
- Refresh
Subscriptions Folder
- Create Subscription
- Refresh
Subscription Node
- Reinitialize Subscription
- Drop Subscription
- Refresh
Agent Node
- Start/Stop Agent
- View History
- Refresh
Command Line Interface
The extension also supports command-line operations through VS Code's built-in terminal:
# Open VS Code with SQL Replication view
code --command "workbench.view.extension.replicationExplorer"
# Add a new connection (requires user interaction)
code --command "sqlrepl.addConnection"
# Refresh the replication view
code --command "sqlrepl.refreshTree"