MySQL for the Oracle DBA - Object Management

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    MySQL for the Oracle DBA - Object Management - Presentation Transcript

    1. 4a. MySQL Object Management for the Oracle DBA Ronald Bradford Senior Consultant MySQL Inc January 2008 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­1 Copyright 2008 MySQL Inc
    2. Agenda GOAL: Creating and Managing MySQL Objects   SQL Object Types  Creating Objects  Managing Objects  MySQL Data Dictionary  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­2 Copyright 2008 MySQL Inc
    3.   SQL Object Types 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­3 Copyright 2008 MySQL Inc
    4. Object Types User  No Sequences Database     (Schema)  No Snapshots Tablespace / Data File  No Synonyms Table / Column  Index  View  Trigger  Stored Procedure  Stored Function  User Defined Function (UDF)  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­4 Copyright 2008 MySQL Inc
    5. Users There is no concept of user ownership within MySQL   All objects are part of a database (or 'schema')   Users only have object privileges assigned to them   4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­5 Copyright 2008 MySQL Inc
    6. Table / Column Table Name is case sensitive (by default)  Reserved Words are permitted (appropriately quoted)  http://dev.mysql.com/doc/refman/5.1/en/reserved­words.html 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­6 Copyright 2008 MySQL Inc
    7. Indexes Default Index type is BTREE  Memory has HASH & BTREE Indexes  MyISAM has a FULLTEXT Index  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­7 Copyright 2008 MySQL Inc
    8. Views Updatable and non­updatable views supported  view and table names must be unique  DEFINER clause allows view to run as the calling user,   or another defined user View restrictions  cannot contain a subquery in the FROM clause.  cannot refer to system or user variables.  cannot refer to prepared statement parameters.  Within a stored routine, the definition cannot refer to routine   parameters or local variables. 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­8 Copyright 2008 MySQL Inc
    9. Views View restrictions (cont)  Any table or view referred to in the definition must exist.   However after creation, underlying objects can be dropped or  modified. View is not invalidated, but will throw error on usage. The definition cannot refer to a TEMPORARY table  You cannot create a TEMPORARY view.  The tables named in the view definition must already exist.  You cannot associate a trigger with a view.  View algorithms  MERGE  TEMPTABLE  UNDEFINED  Supports WITH CHECK OPTION  Do not support Materialized Views  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­9 Copyright 2008 MySQL Inc
    10. Triggers DML triggers only ­ no system triggers  [BEFORE | AFTER] [INSERT | UPDATE | DELETE]  Only one of each trigger type supported  FOR EACH ROW, no FOR EACH STATEMENT  No INSTEAD OF  No WHEN Condition  NEW.col and OLD.col syntax  CALL statement for SP not permitted  No statements that implicitly or explicitly COMMIT |   ROLLBACK  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­10 Copyright 2008 MySQL Inc
    11. Stored Procedures PL/PSM (Persistent Stored Modules)   Non scrollable, read only cursors  Support for most loop types (FOR loops not yet)  DEFINER clause allows stored procedure to run as the   calling user, or another defined user No packages support  No anonymous blocks  No concept of dependency within MySQL  Stored procedures are not required for high   performance within MySQL 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­11 Copyright 2008 MySQL Inc
    12. User Defined Functions (UDF) Added as Object Files  Compiled and available on permanent basis  mysql> create function logger returns integer soname 'syslogudf.so'; mysql> select logger('logging from ' + version()); http://dev.mysql.com/doc/refman/5.0/en/adding­functions.html 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­12 Copyright 2008 MySQL Inc
    13. MySQL Create Object Limitations No online ALTER Table  No online Add Tablespace Data File  Online Add Index (5.1)  Online Add Enum Value (5.1)  Online Add Column (5.1 ­ MyISAM)  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­13 Copyright 2008 MySQL Inc
    14. MySQL Auto Increment Replacement for SEQUENCE Limitations  Only one per table  No System wide concept  No Get Next capability  Get Value after Insert with LAST_INSERT_ID()  No required in INSERT, or NULL can be used  No persistence of true max value used across restart  exists in Falcon 6.0  http://dev.mysql.com/doc/refman/5.0/en/example­auto­increment.html 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­14 Copyright 2008 MySQL Inc
    15.   MySQL Data Dictionary 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­15 Copyright 2008 MySQL Inc
    16. MySQL Data Dictionary Two Present Sources Privilege/System Tables ­  'mysql' database   Information Schema  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­16 Copyright 2008 MySQL Inc
    17. 'mysql' database Privileges (host, db ,user, tables_priv, columns_priv,procs_priv)  Help (help_category, help_keyword, help_relation, help_topic)  Time zones (time_zone, time_zone_name,   time_zone_leap_second, time_zone_transition,  time_zone_transition_type) Procedure & Function (proc, func)  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­17 Copyright 2008 MySQL Inc
    18. INFORMATION_SCHEMA 5.0 SCHEMATA, TABLES, COLUMNS, TABLE_CONSTRAINTS,   VIEWS, STATISTICS USER_PRIVILEGES,   SCHEMA_PRIVILEGES,TABLE_PRIVILIGES,  COLUMN_PRIVILEGES CHARACTER_SETS, COLLATIONS,   COLLATION_CHARACTER_SET_APPLICIBILITY ROUTINES, PROFILING  5.1 KEY_COLUMN_USAGE,PLUGINS,ENGINES,PARTITIONS,EVENT  S,FILES, REFERENTIAL_CONSTRAINTS, PROCESSLIST, GLOBAL_STATUS,   SESSION_STATUS,GLOBAL_VARIABLES,SESSION_VARIABLES  6.0 FALCON_  4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­18 Copyright 2008 MySQL Inc
    19.     4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­19 Copyright 2008 MySQL Inc
    20. INFORMATION_SCHEMA Examples Table Disk Size for given schema  select table_name, table_rows, avg_row_length,        data_length/1024/1024 as data_mb,         index_length/1024/1024 as index_mb  from information_schema.tables  where table_schema='dbname' order by 4 desc; 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­20 Copyright 2008 MySQL Inc
    21. INFORMATION_SCHEMA Examples   SELECT TABLE_SCHEMA, SUM((DATA_LENGTH + INDEX_LENGTH) /  (1024 * 1024)) AS SIZE_MB  FROM  INFORMATION_SCHEMA.TABLES GROUP BY TABLE_SCHEMA ORDER BY SIZE_MB DESC SELECT ROUTINE_TYPE, ROUTINE_NAME FROM  INFORMATION_SCHEMA.ROUTINES WHERE  ROUTINE_SCHEMA='dbname'; SELECT  TRIGGER_NAME,EVENT_MANIPULATION,EVENT_OBJECT_TABLE,  ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE  TRIGGER_SCHEMA='dbname'; SELECT CONCAT('DROP TABLE ',table_name,';') INTO OUTFILE '/sql/drop_tables.sql' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA =  4a. MySQL Object Management 'dbname'; MySQL ­ The Best Online Database for modern applications Version 1.2 4a­21 Copyright 2008 MySQL Inc
    22. INFORMATION_SCHEMA Examples   SELECT s.schema_name, CONCAT(IFNULL(ROUND((SUM(t.data_length)+            SUM(t.index_length))/1024/1024,2),0.00),'Mb')  total_size,  CONCAT(IFNULL(ROUND(((SUM(t.data_length) +SUM(t.index_length))­SUM(t.data_free))/1024/1024,2), 0.00),'Mb') data_used, CONCAT(IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00),'Mb')  data_free, IFNULL(ROUND((((SUM(t.data_length)+SUM(t.index_length))­    SUM(t.data_free))/((SUM(t.data_length) +SUM(t.index_length)))*100),2),0) pct_used,        COUNT(table_name) total_tables FROM information_schema.schemata s LEFT JOIN information_schema.tables t ON s.schema_name =  t.table_schema WHERE s.schema_name != 'information_schema' GROUP BY s.schema_name  ORDER BY pct_used DESC\\G 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­22 Copyright 2008 MySQL Inc
    23.   Questions? 4a. MySQL Object Management MySQL ­ The Best Online Database for modern applications Version 1.2 4a­23 Copyright 2008 MySQL Inc

    + Ronald BradfordRonald Bradford, 7 months ago

    custom

    751 views, 0 favs, 1 embeds more stats

    Example section on MySQL for the Oracle DBA 1 day b more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 751
      • 724 on SlideShare
      • 27 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 25
    Most viewed embeds
    • 27 views on http://ronaldbradford.com

    more

    All embeds
    • 27 views on http://ronaldbradford.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories