Transaction Replication with new schema - sql

I am trying to create Transaction Replication on SQL server 2008 R2.
The subscriber database will be new and we need to set new schema for it, meaning we want to have "NewSchema"."TableName" rather than dbo.tableName.
I have created new database and created new schema and choose this new schema value while creating the replication i.e "Destination Object Owner" for all tables.
After saving the value is again set to default, I read that it is default behaviour of SQL server.
But the problem is when I see the synchronization status it says
"The concurrent snapshot for publication 'xxxx' is not available because it has not been fully generated or the Log Reader Agent is not running to activate it. If generation of the concurrent snapshot was interrupted, the Snapshot Agent for"
The Snapshot is complete and Log reader agent also look fine.
Can you please help me in this!
I think the because of the security/permissions of new schema its failing.
Because earlier with default schema replication worked perfectly fine.
Please can you let me know the steps to follow for this, creating schema, permissions for it and then for replication.
Regards,
Arvind

Here is minimal permissions required for Snapshot, Log Reader and Distribution Agents:
https://msdn.microsoft.com/en-us/library/ms151868(v=sql.105).aspx
You can check the logs, use Replication Monitor and Profiler to find out what's going on and what is missing. It's hard to tell you what to change when we don't have access to your system.

Related

'sa' user is "pinging" my Azure SQL Database

I have a Azure SQL Database with Auditing turned on. I noticed that my database comes online after a pause when it shouldn't. I checked the audit logs and it shows strange entries of 'sa' login trying to do smth. Not sure what these entries mean. Is a normal activity from Azure or somebody is trying to connect to my database? I believe that there is no such user 'sa' on Azure SQL databases, or am I wrong. Attaching the screenshot of audit logs.
Additional_info column shows these values (they repeat for every event).
<action_info xmlns="http://schemas.microsoft.com/sqlserver/2008/sqlaudit_data">destroyed</action_info>
<action_info xmlns="http://schemas.microsoft.com/sqlserver/2008/sqlaudit_data">event disabled</action_info>
<action_info xmlns="http://schemas.microsoft.com/sqlserver/2008/sqlaudit_data">event enabled<startup_type>automatic</startup_type></action_info>
logs
Tried Google, found nothing.
I created azure SQL database in azure portal, and I enabled auditing server level destination as storage account.
Image for reference:
After that I enabled auditing at database level with same destination of storage account.
Image for reference:
It enabled successfully, and containers are created successfully in storage account.
Image for reference:
Audit Records:
Here is my log
In this way I am not getting any error related to sa user.
As per my knowledge sa user is the admin you created during setup of SQL Azure server
According to this
Once the azure database is in pause status, it resumes automatically in the following conditions:
Database connection
database export or copy
Viewing auditing records
Viewing or applying performance recommendation
Vulnerability assessment
Modifying or viewing data masking rules
View state for transparent data encryption
Modification for serverless configuration such as max vCores, min vCores, or auto-pause delay
May be for above reason database still remains in online when you pause it.

Azure geo replication - recreating link on the same DB

We have a sql database on AZURE, which is geo replicated to another server in different location.
We had incorrect pricing tier on this DB (which also transfered to the geo replica). In order to change it, i had remove DB from failover group and then delete replication link.
Now when i want to recreate the link, it says that DB with this name already exists (which of course does, i deleted the link but not the replicated DB).
Is there any way to recreate link on the existing DB or is the best practise to just delete the replicated DB and create it anew?
Azure Geo Replication Failover is a feature designed for automatically managing replications on database failures.
If it were a manual exception, such as incorrect pricing or schema errors, it would not correct/reflect by default because those databases are read-only, as shown below.
Solution:
1.Delete the database on the replica and re-add the database from the primary server again; it will automatically configure the latest database features; there is no need to delete the link.
Step2:
Create a new replica link from primary to failover again

SQL Azure Database Copy status

Copying a database in the Azure Portal is never ending.
Usually, when I copy a 250GB database, it completes in just under an hour.
Today, when I copy, it never seems to finish, it has been over two to three hours now.
And in the server activity logs, the last entry just says an update occured
Any idea on how to see more progress, percent complete, or any other way to see what might be locking it? Nothing of use can be seen in the activty log json.
You can use SYS.DM_OPERATION_STATUS to track many operations including copy in SQLAZURE..
Documentation states
To use this view, you must be connected to the master database. Use the sys.dm_operation_status view in the master database of the SQL Database server to track the status of the following operations performed on a SQL Database:
Below are the operattions that can be tracked
Create database
Copy database. Database Copy creates a record in this view on both the source and target servers.
Alter database
Change the performance level of a service tier
Change the service tier of a database, such as changing from Basic to Standard.
Setting up a Geo-Replication relationship
Terminating a Geo-Replication relationship
Restore database
Delete database
You can also try sys.dm_database_copies in master database for info about copy status ..This has percent_complete field and below is what documentation has to say about this
The percentage of bytes that have been copied. Values range from 0 to 100. SQL Database may automatically recover from some errors, such as failover, and restart the database copy. In this case, percent_complete would restart from 0.
Note:
This view has info only during the duration of copy operation..

Add SQL Replication Bundle to existing database?

I have a database with data I would like to replicate to a SQL server. I am aware that I can add RavenDB replication after the fact in the Settings menu.
However, I don't find any setting for adding the SQL Replication bundle except during database creation (see image below).
Would it be best to create a new database with SQL replication enabled then replicate my old database to that one?
Judging by the Studio screenshot I assume RavenDB version 3.0/3.5
(in the upcoming version 4.0 this most likely would be handled differently)
Creating a new database with SQL replication bundle enabled, then replicating to the new database would work.
There is another option - simply add "SqlReplication" to key "Raven/ActiveBundles" in the database document. Then, cause the database to reload (disable then enable the database).
Like this:

Database Properties "Mirroring" Page

I am having a problem with one database on my SQL Server 2005 production server.
A number of databases are already set up for mirroring, however when I right click and go to properties in SSMS, on one particular database there is no "Mirroring" property page available.
I have done the normal tasks, such as setting Full Recovery model, running a full backup of the database and backing up the logs.
I can't see that this is a server specific issue as other databases are happily mirroring.
I've looked around and I can't see that I'm missing a setting, any help would be appreciated.
Thanks.
EDIT: This is nothing to do with the Mirror Database yet, I can't get as far as specifying the Mirror Database , I cannot see the "Mirroring" page on the principle.
EDIT: I have managed to setup mirroring using t-sql commands. However I am still unable to see the "Mirroring Page".
UPDATE: This applies to the Transaction Log Shipping option as well. I can successfully set it up in SQL but not through SSMS.
Check theese items:
2 . The mirror database has to be created from a full backup of the principal server and should be restored in "Restore with Norecovery" model. It is followed by a restore of transaction log backup of the principal database so that the log sequence numbers of the mirror and the principal database are in synch with each other.
3 . The mirror database must have the same name as the principal database.
...
8 . DB Mirroring is available in Enterprise, Developer and Standard Editions, however, please refer to Microsoft website for a comparison chart as some features are not available in the Standard Edition. SQL Server Workgroup and Express Editions can only be used as witness servers.
Database Mirroring in Microsoft SQL Server 2005
Test monitoring with sp_dbmmonitorresults (Transact-SQL)
I don't have the answer, but I ran across the same symptom yesterday, and I remembered your question here, hahaha. My problem was that I set up database mirroring using the wizards, but one of the systems had a firewall blocking the mirroring port. The wizard setup went all the way to the final part of enabling database mirroring, and then errored out - but at that point, mirroring was already set up. Mirroring worked great, but there was something in the database metadata that wasn't set quite right. Even when I removed the firewall, parts of SSMS acted as if mirroring wasn't set up for that particular database, even though it was.
I then set up additional databases for mirroring (with the firewall off) and they worked great. My solution was to remove mirroring on that database and then add it again, and it worked fine. Doesn't sound like that's worked for you, though.
I ended up having to have a Microsoft Support call for the problem I was facing. Anyway after sometime and a number of support sessions they worked out that the database with the problem had an ID of 4 in sys.databases. IDs 1-4 are usually reserved for the system databases and if a database has any of these ids the T-log or Mirroring properties are not displayed. So somehow our database got the ID 3 and now I better get on and detach and reattach some databases to reassign IDs.