Returning data from a stored procedure using Amazon RDS

  • Hi - I'm new to this community and an SQL novice. I am trying to call a stored procedure and the result returned in a variable. In particular I am calling the AWS procedure EXECUTE msdb.dbo.rds_task_status @db_name='MyDatabase'

    This is returning the result set IN SSMS, but I don't know how I query the result set returned, so I can get at the column data. For example getting the lifecycle output parameter returned by this proc.
    I would ideally like to call this every 10 seconds until I get a lifecycle status back as SUCCESS
    Any help on how to achieve this is gratefully received.

    Regards,
    Andy.

  • andy.apollocentral - Sunday, September 16, 2018 2:23 PM

    Hi - I'm new to this community and an SQL novice. I am trying to call a stored procedure and the result returned in a variable. In particular I am calling the AWS procedure EXECUTE msdb.dbo.rds_task_status @db_name='MyDatabase'

    This is returning the result set IN SSMS, but I don't know how I query the result set returned, so I can get at the column data. For example getting the lifecycle output parameter returned by this proc.
    I would ideally like to call this every 10 seconds until I get a lifecycle status back as SUCCESS
    Any help on how to achieve this is gratefully received.

    Regards,
    Andy.

    Did you read the manual?

    https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html

    Tracking the        Status of Tasks                                          

    To track the status of your backup and restore tasks, you call the         stored procedure. If you don't provide any parameters,        the stored procedure returns the status of all tasks. The status for tasks is        updated approximately every 2 minutes.        

    To track the status of your backup and restore tasks, you call the   rds_task_status stored procedure. If you don't provide any parameters,        the stored procedure returns the status of all tasks. The status for tasks is updated approximately every 2 minutes.        


    If you call it even 1/10 of a second, it won't do anything except increasing the network traffic and the bottom line of the bill from Amazon.

    As for the catching the output - did you try to insert the resultset into a table?

    _____________
    Code for TallyGenerator

  • OK - Thanks for the info on this. I'll explain what I'm trying to do as I may be going the wrong way about it.
    I want to copy an Amazon RDS database from one RDS instance to another that will potentially be on another server and also another AWS account. The destination database won't exist and upon copy it must have all schema and data from the source including keys.

    My first intention was to create a backup of the database to an S3 bucket, then wait until the backup was complete (Hence the need to call task_status) then restore the database with a new database name on the destination server. Is this possible? Is there an easier way?

    Thanks for any help.
    Andy.

  • @Andy.apollocentral were you able to get an answer to this.  I want to do something similar.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply