Questions tagged [policy-based-management]

For questions about SQL Server Policy Based Management

11 questions
10
votes
1 answer

Issue with Table Naming Conventions and Policy Management in SQL Server 2016

In SQL Server 2012, I had a policy set to not allow spaces in a table name. However, when I use the same policy in SQL Server 2016, I get an error. Here is the code for the condition: DECLARE @condition_id INT EXEC…
5
votes
1 answer

Prevent users creating constraints or indexes with no name

I have done some searching but haven't found a solution to my problem. I started with some databases where users didn't care to name PK constraints, foreign keys or indexes, ending up with system generated names like PK__CarRenta__3213E83F2E5BD364.…
2
votes
2 answers

Is it best practice to revoke server permissions to the server "public" role on SQL Server instances?

We have evaluated the Microsoft "best practice" policies (located at C:\Program Files (x86)\Microsoft SQL Server\number\Tools\Policies\DatabaseEngine\1033) on each of our SQL Server instances (example here). The following issue has been flagged up…
2
votes
1 answer

Enforce conditions on queries

Currently I have a simple schema, a sites table and an items table. Sites own many items, items has a siteId column to store the reference of the site which owns it. I'd like to be able to enforce a condition when querying items, meaning returning…
Ben
  • 165
  • 7
1
vote
1 answer

Postgres/Postgis : setting up rls policies

So i'm trying to configure the different accesses for mutliple users to my postgres/postgis database. Basically I have 1 manager user and 4 weak users accessing the db. What I would like to do is to prevent a weak user to be able to delete entries…
tonyduky
  • 11
  • 2
1
vote
0 answers

Issue with table naming policy with PBM - can't create it passed in the condition or not

I used PBM to create a condition to blocking create tables if nomenclature no haven't the prefix tbl: EXEC msdb.dbo.sp_syspolicy_update_condition @condition_id=24, @description=N'Necessário acrescentar o prefixo ''tbl''',…
1
vote
1 answer

How to select only one database in a policy in SQL Server?

I am creating a new policy which shows sproc creation dates. I am based on Stored Procedure facet and appropriate condition is created. Now I want this policy to include only one database in an instance When I select new policy from the dropdown…
igelr
  • 2,006
  • 1
  • 11
  • 36
1
vote
0 answers

User-defined Policy Evaluates to True when Evaluated but False when Invoked by Test-SqlAvailabilityReplica

I created a PBM condition and policy in SSMS. The policy runs a T-SQL script using the ExecuteSql function against the Server facet to determine whether all databases that are expected to be a member of an availability group are in fact members of…
0
votes
0 answers

postgresql - Policy to prevent a field from being updated

How can I create a policy to prevent a field from being updated? I am thinking something like this: CREATE POLICY "test" ON posts.created_at FOR UPDATE WITH CHECK (exists(created_at)); Obviously this does not work, but I would like a way for this…
0
votes
1 answer

Using Policy-Based Management to check backup history for an Availability Group database

I like using Policy-Based Management to do some simple "everything's okay" sanity checks and email me if something goes out of spec. Typically, I validate the time since the last full backup, both to verify backups are running on schedule, and also…
db2
  • 9,448
  • 2
  • 30
  • 56
-1
votes
1 answer

Why SP_Naming policy still blocked my correct creating?

I used PBM to manage my policy against my user DBs. The Condition is: Declare @condition_id int EXEC msdb.dbo.sp_syspolicy_add_condition @name=N'SP_Naming_convention', @description=N'', @facet=N'StoredProcedure', @expression=N'
DBALUKE HUANG
  • 417
  • 4
  • 15