Tuesday, March 10, 2015

Oracle VM 3: Connecting to MySQL Backend


Oracle VM 3: Connecting to MySQL Backend


Starting in Oracle VM 3.2.1 the built in database of the Oracle VM Manager was MySQL.  I had hoped that this change would also signal a change in the database schema.  In prior versions of OVM 3.x all data was populated in the database in a completely useless longblob form.
# mysql ovs  -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

As we can see it is attempting and failing to use /var/lib/mysql/mysql.sock as the connection.  So lets take a look at the process and see if it has any clues.
# ps -ef | grep mysql
oracle    2234  1778  1 Jan23 ?        00:47:09 /usr/sbin/mysqld --defaults-file=/u01/app/oracle/mysql/data/my.cnf --basedir=/usr --datadir=/u01/app/oracle/mysql/data --plugin-dir=/usr/lib64/mysql/plugin --user=oracle --log-error=/u01/app/oracle/mysql/data/mysqld.err --pid-file=/u01/app/oracle/mysql/data/mysqld.pid --socket=/u01/app/oracle/mysql/data/mysqld.sock --port=49500

Above we see a couple of key pieces of information.  We now know that the socket is /u01/app/oracle/mysql/data/mysqld.sock and we also see that our configuration file is /u01/app/oracle/mysql/data/my.cnf.  So based on this new socket we can attempt to connect to mysql again.

# mysql ovs -S /u01/app/oracle/mysql/data/mysqld.sock -u root -p
Enter password:
mysql>

Now we are connected to the backend, here comes the bad news.  The database is completely worthless, they are still using longblobs for everything.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| ovs                |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
Use the ovs database so we can look at its content.
mysql> use ovs;
Database changed
Next we will show all tables so that we can get an idea of what the schema looks like.
mysql> show tables;
+--------------------------------+
| Tables_in_ovs                  |
+--------------------------------+
| Mgr_AbcStore                   |
| Mgr_AccessManager              |
| Mgr_ActionEngineProperties     |
| Mgr_ActionManager              |
| Mgr_ArchiveManager             |
| Mgr_BackupManager              |
| Mgr_BalancerControl            |
| Mgr_BindingMismatchEvent       |
| Mgr_BondPort                   |
| Mgr_BusinessManager            |
| Mgr_Cluster                    |
| Mgr_Coherence                  |
| Mgr_ControlDomain              |
| Mgr_CpuCompatibilityGroup      |
| Mgr_CreateStatisticLog         |
| Mgr_CreatedEvent               |
| Mgr_DeletedEvent               |
| Mgr_DiscoverEngineProperties   |
| Mgr_DiscoverManager            |
| Mgr_EthernetNetwork            |
| Mgr_EthernetPort               |
| Mgr_EventEngineProperties      |
| Mgr_EventLog                   |
| Mgr_EventManager               |
| Mgr_FibreChannelStorageArray   |
| Mgr_FileManager                |
| Mgr_FileSystemMount            |
| Mgr_FileSystemPlugin           |
| Mgr_Foundry                    |
| Mgr_HashMap                    |
| Mgr_InformationalEvent         |
| Mgr_InternalJob                |
| Mgr_InternalPort               |
| Mgr_InternalSystemLog          |
| Mgr_InternalTaggingObject      |
| Mgr_IscsiStorageArray          |
| Mgr_IscsiStorageInitiator      |
| Mgr_Iterator                   |
| Mgr_JobConstructingEvent       |
| Mgr_JobDoneEvent               |
| Mgr_JobRunningEvent            |
| Mgr_LinkedList                 |
| Mgr_LocalFileServer            |
| Mgr_LocalFileSystem            |
| Mgr_LocalStorageArray          |
| Mgr_LocalStorageInitiator      |
| Mgr_LocalStoragePath           |
| Mgr_LogEngineProperties        |
| Mgr_LogManager                 |
| Mgr_LogStore                   |
| Mgr_ModelEngineProperties      |
| Mgr_ModelManager               |
| Mgr_NetworkFileServer          |
| Mgr_NetworkFileSystem          |
| Mgr_NetworkSelectionManager    |
| Mgr_ObjectChangeEvent          |
| Mgr_ObjectCheckerTask          |
| Mgr_OdofManager                |
| Mgr_OvfAssembly                |
| Mgr_PathDownEvent              |
| Mgr_PathUpEvent                |
| Mgr_PerfManager                |
| Mgr_PortDownEvent              |
| Mgr_PortUpEvent                |
| Mgr_Processor                  |
| Mgr_Properties                 |
| Mgr_QueuedJobCreateEvent       |
| Mgr_QueuedServerUpdateNtpServe |
| Mgr_QueuedServerYumRepositoryU |
| Mgr_RasEngineProperties        |
| Mgr_RasManager                 |
| Mgr_RefreshRepoFileSystemsTask |
| Mgr_Repository                 |
| Mgr_RestoreManager             |
| Mgr_RoleService                |
| Mgr_RootStatisticLog           |
| Mgr_RulesEngineProperties      |
| Mgr_RulesManager               |
| Mgr_SchedulableTaskProperties  |
| Mgr_Server                     |
| Mgr_ServerClusterStateDownEven |
| Mgr_ServerDefaultInfo          |
| Mgr_ServerDisconnectErrorEvent |
| Mgr_ServerDiscoverScanEvent    |
| Mgr_ServerNotification         |
| Mgr_ServerOfflineEvent         |
| Mgr_ServerOutofDateEvent       |
| Mgr_ServerPool                 |
| Mgr_ServerPoolMasterMissingEve |
| Mgr_ServerRunningEvent         |
| Mgr_ServerSelectionManager     |
| Mgr_ServerStartingEvent        |
| Mgr_ServerStoppedEvent         |
| Mgr_ServerUserMissingEvent     |
| Mgr_ServerVersionMismatchWarni |
| Mgr_ServerYumRepositoryInforma |
| Mgr_ServerYumUpdateCheckingEve |
| Mgr_SeverityChangeEvent        |
| Mgr_StatisticManager           |
| Mgr_StatisticSubjectLog        |
| Mgr_StatisticTypeLog           |
| Mgr_StatsIntervalAdjusterTask  |
| Mgr_StorageArrayPlugin         |
| Mgr_StorageDeviceUpEvent       |
| Mgr_StorageElement             |
| Mgr_StorageSelectionManager    |
| Mgr_Tag                        |
| Mgr_TaskEngineProperties       |
| Mgr_TaskManager                |
| Mgr_TreeMap                    |
| Mgr_TreeStore                  |
| Mgr_User                       |
| Mgr_UserAccount                |
| Mgr_UserStore                  |
| Mgr_VirtualCdrom               |
| Mgr_VirtualDisk                |
| Mgr_VirtualMachine             |
| Mgr_VirtualMachineCfgFile      |
| Mgr_VirtualMachineDisconnectEr |
| Mgr_VirtualMachineRunningEvent |
| Mgr_VirtualMachineStartingEven |
| Mgr_VirtualMachineStoppedEvent |
| Mgr_VirtualMachineStoppingEven |
| Mgr_VirtualMachineSuspendedEve |
| Mgr_VirtualMachineTemplate     |
| Mgr_VmApiMessages              |
| Mgr_VmCloneDefinition          |
| Mgr_VmCloneNetworkMapping      |
| Mgr_VmCloneStorageMapping      |
| Mgr_VmDiskMapping              |
| Mgr_VmSelectionManager         |
| Mgr_Vnic                       |
| Mgr_VnicManager                |
| Mgr_VnicManagerProperties      |
| Mgr_VolumeGroup                |
| Mgr_XenHypervisor              |
| Mgr_YumRepoOutofDateEvent      |
| Mgr_YumUpdateCheckerTask       |
| Odof_id_to_type                |
| Odof_not_tabled                |
| Odof_sys_properties            |
| Odof_type_to_class             |
| WL_LLR_ADMINSERVER             |
+--------------------------------+
143 rows in set (0.00 sec)
Now lets look at the columns of the Mgr_VirtualMachine table.
mysql> describe Mgr_VirtualMachine;
+--------+------------+------+-----+---------+-------+
| Field  | Type       | Null | Key | Default | Extra |
+--------+------------+------+-----+---------+-------+
| m_id   | bigint(20) | NO   | PRI | 0       |       |
| m_data | longblob   | YES  |     | NULL    |       |
+--------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Now lets look at the columns of the Mgr_Server table.
mysql> describe Mgr_Server;
+--------+------------+------+-----+---------+-------+
| Field  | Type       | Null | Key | Default | Extra |
+--------+------------+------+-----+---------+-------+
| m_id   | bigint(20) | NO   | PRI | 0       |       |
| m_data | longblob   | YES  |     | NULL    |       |
+--------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
Here is a command to pull the whole schema, and every single table has two tables, m_id and m_data with the m_data being longblog.
mysqldump --no-data ovs -S /u01/app/oracle/mysql/data/mysqld.sock -u root -p

No comments:

Post a Comment

  How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...