# Database Control Functions

> These functions are used to perform database operations such as: open and close, connect and disconnect, extend working memory, manage backup and recovery.

> ## General

> mco_db_open
> Open a database (for backward compatibility)
> mco_db_open_dev
> Open a database with specified memory devices
> mco_db_open_disk
> Open a database on persistent storage (for backward compatibility)
> mco_db_close
> Close a database
> mco_close_all_instances
> Close all database instances
> mco_db_kill
> Remove a shared memory segment associated with a database
> mco_db_connect
> Connect to a database
> mco_db_connect_ctx
> Connect to a database specifying a context
> mco_db_connection_context
> Returns the database context data associated with an existing database connection
> mco_db_disconnect
> Disconnect from a database
> mco_db_register_udf
> Register a user-defined function
> mco_db_params_init
> Initialize database parameters
> mco_db_extend
> Extend database memory
> mco_db_extend_ctx
> Extend database memory using user context
> mco_db_extend_t
> Extend database memory within a transaction
> mco_db_extend_dev
> Extend database memory by adding a memory device
> mco_db_extend_dev_ctx
> Extend database memory by adding a memory device using user context
> mco_db_extend_dev_t
> Extend database memory within a transaction by adding a memory device
> mco_db_detach_dev_ctx
> Reduce database memory by detaching a memory device
> mco_db_detach_dev
> Reduce database memory by detaching a memory device
> mco_db_register_collations
> Register custom collation functions for a database instance.

> ## Snapshot

> mco_db_save
> Save a database image to an external file
> mco_class_save
> Save an entire class to an external file
> mco_inmem_save
> Save transient (in-memory) classes to an external file
> mco_disk_save
> Save persistent classes to an external file
> mco_db_json_export
> Export the entire database contents in JSON format
> mco_db_save_metadata
> Save the database internal data layout definition to an external file
> mco_db_save_dictionary
> Save the database dictionary to an external file
> mco_db_load
> Load a database image from an external file
> mco_class_load
> Load an entire class from an external file
> mco_inmem_load
> Load transient (in-memory) classes from an external file
> mco_disk_load
> Load persistent classes from an external file
> mco_disk_load_file
> Load database files from persistent storage

> ## Recovery

> mco_db_sniffer
> Inspect the state of all connections and perform recovery if dead connections are detected
> mco_db_sniffer_ex
> This function is extended version of `mco_db_sniffer()` function
> mco_db_recover_required()
> Determine from the log file if any databases connections were not properly closed
> mco_db_recover()
> Allows an application to explicitly recover a database
> mco_db_recover_all()
> Allows an application to explicitly recover any database connections that were not properly closed

> ## Auxiliary

> mco_db_databases
> List all registered database names
> mco_db_clean
> Remove all objects from a database
> mco_current_registry_size
> Return the number of bytes required to load the database registry
> mco_get_last_autoid
> Return the last generated autoid value
> mco_get_class_code
> Return the class code of the object referenced by an object handle
> mco_copy_handle
> Copy an object handle
> mco_is_object_deleted
> Determine if an object has been deleted within the current transaction
> mco_aio_start()
> Adjust Asynchronous IO parameters for persistent databases
> mco_aio_stop)
> Stop Asynchronous IO