Using ASP Session State DB on AWS RDS - sql

I know this has been a topic that has been discussed in AWS forums before
and SO How to setup sessionState with SQL Server mode on Amazon RDS
As mentioned on the above thread and on a couple of stack overflow articles it would seem like there is a way to get a SQL session using AWS RDS. I used the above stackoverflow as guidance to try and set up my ASPState database. Using the pastebin script in the above stackoverflow article for a "jobless" InstallSqlState.sql still caused me issues as it tries to use "tempdb" and "master". I don't have access to these databases neither can I grant myself permissions to do so.
However had a working site that used the sessions table on an EC2 server. As per the above stackoverflow article I used the SQL import/export tool.
The database seemed to copy over okay, tables and stored procedures all seem to be present and correct.
In my web.config I have:
<sessionState mode="SQLServer" allowCustomSqlDatabase="true" cookieless="false" timeout="45" sqlConnectionString="data source=RDSIP;initial catalog=ASPState;user id=myuser;password=mypassword" />
However when I run my site I get the error:
Invalid object name 'tempdb.dbo.ASPStateTempApplications'.
Is there anyone who has managed to achieve a session state using SQL on AWS RDS or can point me to a resource that can explain the steps I need to take?

After some digging around I realised that the stored procedures being generated by the pastebin script are still making reference to the tempdb. By doing a simple find replace of [tempdb] to [ASPState] and then re-running the script recreated SP with the correct DB name.
I also changed the "USE" statements to databases I had permissions for.

I've solved my issue create session db on Amazon RDS.
1 Step:- Create ASPState DB on AWS RDS and database and schema migration using Following Tool SQLAzureMW v5.15.6 Release Binary for SQL Server 2014.
2 Step:- change DB Name on sessionState mode="SQLServer" allowCustomSqlDatabase="true" sqlConnectionString="data source=amazon-server-name;initial catalog=ASPState;persist security info=True;user id=userid;password=password" cookieless="false" timeout="100">
please feel free to contact us about any of your queries
Thanks
Amit Verma

I solved the issue by generating scripts for the whole schema (Tasks -> Generate Scripts) from a locally create session database, and then running the same on the RDS instance on a newly created session database.
For the job, I created it manually by copying the exact steps from my local instance.
The setup is running fine till now.

Related

Azure ADF unable to create linked service to an Azure SQL server VM in a different tenancy or subscription

I am trying to create a pipeline to copy some data between Azure SQL databases on different servers, but creating a Linked Service using SQL authentication fails (and gives no helpful information, just a dialog box saying it failed). I think that the server VMs are in different tenancies or different subscriptions (I am not sure of the distinction), so I am guessing that the one I am working in cannot see the one I want the connection to go to. Is that likely, and what needs to be done to make it work? Any advice welcome, including RTFM if you can point me at the right one and it doesn't take weeks to wade through it!
In case anyone hits the same issue: the problem turned out to be the 'encrypted' checkbox in the self-hosted integration runtime (IR). Clearing this flag allowed the IR to see the target database, and the pipeline could then be created with the new connection set to use that IR. #Leon Yue: both databases are Azure SQL instances on Azure PaaS VMs.

API for Azure Database for MySQL

Azure Database for MySQL server is still in preview, though we can created database instance on it.
I wonder do we have any API to retrieve the databases that we created on Azure Database for MySQL server? API for metrics of those databases?
Same questions for Azure Database for PostgreSQL server. Thanks!
Related Azure portal screenshot
We have just released the REST API spec today. You can find it here - https://learn.microsoft.com/en-us/rest/api/mysql/
Here's the REST API reference to list all the databases under a server: https://learn.microsoft.com/en-us/rest/api/mysql/databases#Databases_ListByServer
well, they obviously exist, but they are not publicly available yet. I don't see anything reasonable on the REST API reference page.
You may figure this out using the Azure portal + fiddler combo ;)
What do you mean retrieve the databases? You can connect to them in Visual Studio with your SQL server object explorer and entering the server name Azure gave you as the server. I don't know if I am understanding your question right? You can connect to the database just like any other SQL database using a SqlConnection.
EDIT:
I looked into it a little more:
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-dotnet-visual-studio
Essentially what I was saying. Provided you have successfully connected your SQL db to Azure you just access it like any other database. For PostgresSql, look into using NpgsqlConnection instead of SqlConnection. They have very similar functionality.

Transaction Replication with new schema

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.

Azure Database Federation Error

tried creating a federation from using sql server management studio but got this weird error after executing the CREATE FEDERATION command.
here is the query and the error result after executing it.
I just hope someone has ran into this before.
Happy Coding..
Federations are no longer supported in Azure SQL Database. Depending on your application, consider putting each Federation member into its own dedicated database in an Elastic Pool, or sharding your data across a few databases. The different alternative application patterns with links to the feature documentation are discussed in more detail here: https://azure.microsoft.com/en-us/documentation/articles/sql-database-design-patterns-multi-tenancy-saas-applications/.
Hope this helps.
Thanks,
Torsten

Oracle database - copying objects to remote database and modifying so they use the remote database only if the local database is offline

I'm new to the forum and am studying Oracle SQL and PL/SQL. I have created a local database and a database link to a remote database to which I have to copy all my objects.
I think I'll be able to do the copying of the objects from local to remote database, but neither my course material nor my googling have given me much of a steer in terms of the modifying the objects to use the remote tables only if the local database is offline.
I'd be hugely grateful if anyone has done a similar task and could point me in the direction of any good material on the subject.
(I'm working with Oracle 11g Express and Oracle SQL Developer)
Many thanks in advance
Edit from original poster:
I got some clarification on the task requirement (see comments below) and I've created a new thread to ask my next question about creating packages at the remote database end. thanks guys for your help so far.
If database A is offline, a database link from database A to database B will not do you any good, as it will not be accessible. The same is the case with PL/SQL, PL/SQL on database A will not be available if database A is down. This is not a problem you will solve with PL/SQL and database links.
Transparent Application Failover (http://docs.oracle.com/cd/B19306_01/java.102/b14355/ocitaf.htm) could solve part of the problem, allowing a connection to failover to database B if database A is down. However, it will not automatically switch back to database A when the database comes back up, unless you try a connection to database A again. You will need to have your PL/SQL code copied on both databases.
There are already robust failover mechanisms in Oracle, some free and required some hacking, such as redo log application, some costly but well supported, such as Oracle Data Guard. I would suggest you review your design and what you are trying to accomplish. If I had to absolutely do what you are trying to do, I would throw a web service in front of each database, use a load balancer in front of the web services that always connected to service A, unless it was down, in which case it would connect to service B.