SQL Anywhere, on-demand edition Using Administration Tools
Module 14 - Using SQL Anywhere Administration Tools
In this module, you will learn how to use SQL Anywhere and its administrative tools to work with the databases in the cloud. SQL Anywhere provides design and management tools for data management and data exchange. You will learn how to connect to your databases in the on-demand edition cloud using the administration tools, how to execute SQL using Interactive SQL, and how to compare database schemas with Sybase Central. To learn more about the features of SQL Anywhere, refer to the documentation at http://dcx.sybase.com/index.html#1201/en/sqlanywhere_en12/help_top_index.htm.
Your cloud should have the basic architecture set up with at least a few tenant databases running. This module requires that you have the SQL Anywhere Developer Edition installed.
Connecting to a Running Database with Sybase Central or Interactive SQL
Sybase Central and Interactive SQL are graphical tools used for database administration. Sybase Central allows you to manage your database servers, databases, and the objects they contain. To see some of the key features and capabilities of Sybase Central, refer to http://dcx.sybase.com/index.html#1201/en/dbadmin/scover.html.
Interactive SQL allows you to execute SQL statements, build scripts, and display database data for your databases. To see some of the key features and capabilities of Interactive SQL, refer to http://dcx.sybase.com/index.html#1201/en/dbadmin/da-guitools-secta-4195292.html.
To connect to a running database in the cloud:
- Open the Sybase Central or Interactive SQL application.
- For Sybase Central, in the menu bar, click Connections, then Connect with SQL Anywhere 12…; the Connect dialog will appear. In Interactive SQL, the Connect dialog should appear upon starting the application.
- In the Authentication dropdown list, select Database. Type the credentials for the database you want to connect to in the User ID and Password fields.
- In the Action dropdown list, select Connect to a running database in the cloud. Then, in the Host field, type the name of one of the hosts in your on-demand edition cloud and in the Port field, type the port for any sever running on that host. Note: You can also enter multiple hosts in the hosts and port fields, separated by commas. You will recall doing this when making client connections to your databases in previous modules. Multiple hosts are used in connection parameters in case one of the hosts is unavailable.
- In the Database name field, type the name of the database you want to connect to. Click Connect to initiate the connection for Sybase Central or Interactive SQL. You can now use your respective tool to work on your database in the on-demand edition cloud.
- Once connected to your database, you can use Sybase Central to maintain your database or use Interactive SQL to execute SQL commands.
Comparing Database Schemas
One of the features of Sybase Central is the ability to compare the schema of two databases, a source, and a target. The comparison tool outputs a set of SQL statements that can be run on the target database to make it the same as the source database. This is useful, for example, if a database has had changes made to it while offline and needs those changes reflected on the copy located in the on-demand edition cloud.
To compare database schemas:
- Open Sybase Central and click Tools in the menu bar. Then click SQL Anywhere 12 > Compare Databases. The Compare Databases window will appear.
- Choose the source database and the target database you want to compare. If the databases were not already added to Sybase Central, click the button to the right of the database dropdown list to make a connection to the database. Click Compare. A set of SQL statements will appear showing the commands that can be run on the target database to match the source database. In this example, Tenant3 and Tenant2 are identical databases except for one column. The column Fax in the table Contacts is removed from Tenant3.
- To execute the SQL statements necessary to sync the two databases, click Open in Interactive SQL. You can now use Interactive SQL to make any necessary changes to the SQL statements, and then execute the statements. Ensure that there are no other connections to the target database and that you back up the target database before executing the statements.