Azure SQL Database (PaaS) is a fully managed platform as a service that provides many benefits like automatic scaling, patching, and backups. However, it does come with some limitations compared to traditional SQL Server installations, including restrictions on accessing system tables.
- Accessing system tables in Azure SQL Database:
In Azure SQL Database, you do not have access to the full set of system tables available in traditional SQL Server installations. Instead, you have access to a limited set of catalog views and dynamic management views (DMVs) that provide information about your database objects and performance.
To access system information, you can query the available catalog views and DMVs. For example:
SELECT * FROM sys.objects;
SELECT * FROM sys.dm_exec_requests;
You can find a list of supported catalog views in Azure SQL Database here: https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/catalog-views-transact-sql
And a list of supported dynamic management views here: https://docs.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/system-dynamic-management-views
- Rationale for not permitting access to all system tables:
The main reason for this limitation is that Azure SQL Database is a managed service where the underlying infrastructure, including the server and its resources, is managed by Microsoft. Providing full access to system tables could potentially expose sensitive information or allow actions that could compromise the stability, performance, or security of the service.
- System tables access in Azure SQL Managed Instance:
Azure SQL Managed Instance is another PaaS offering that provides more features and compatibility with SQL Server compared to Azure SQL Database. It is designed for easy migration of on-premises SQL Server workloads to the cloud.
With Azure SQL Managed Instance, you have more access to system tables and other SQL Server features. However, there are still some differences compared to on-premises SQL Server installations. You can review the differences and limitations here: https://docs.microsoft.com/en-us/azure/azure-sql/managed-instance/transact-sql-info
In summary, while you can't access all system tables in Azure SQL Database, you can use the supported catalog views and dynamic management views to retrieve the necessary information. If you need more compatibility with SQL Server, consider using Azure SQL Managed Instance, which provides greater access to system tables and other SQL Server features.