

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Riduzione dei tempi di migrazione fisica ad Amazon Aurora MySQL
<a name="AuroraMySQL.Migrating.ExtMySQL.Prechecks"></a>

Puoi apportare le seguenti modifiche al database per velocizzare il processo di migrazione di un database ad Amazon Aurora MySQL.

**Importante**  
Assicurati di eseguire questi aggiornamenti su una copia di un database di produzione, anziché sul database di produzione stesso. Puoi eseguire il backup della copia e quindi ripristinarlo nel cluster database Aurora MySQL per evitare interruzioni del servizio nel database di produzione.

## Tipi di tabella non supportati
<a name="AuroraMySQL.Migrating.ExtMySQL.Prechecks.Tables"></a>

Aurora MySQL supporta solo il motore InnoDB per le tabelle di database. Se il database include tabelle MyISAM, queste devono essere convertite prima della loro migrazione ad Aurora MySQL. Il processo di conversione richiede ulteriore spazio per la conversione da MyISAM a InnoDB durante la procedura di migrazione.

Per ridurre la possibilità di rimanere senza spazio o per velocizzare il processo di migrazione, converti tutte le tabelle MyISAM in tabelle InnoDB prima di migrarle. Le dimensioni della tabella InnoDB risultante è equivalente alle dimensioni necessarie da Aurora MySQL per quella tabella. Per convertire una tabella MyISAM in InnoDB, esegui il comando seguente:

```
ALTER TABLE schema.table_name engine=innodb, algorithm=copy;
```

Aurora MySQL non supporta le pagine o le tabelle compresse, ovvero le tabelle create con `ROW_FORMAT=COMPRESSED` o `COMPRESSION = {"zlib"|"lz4"}`.

Per ridurre la possibilità di rimanere senza spazio o per velocizzare il processo di migrazione, espandi le tabelle compresse impostando `ROW_FORMAT` su `DEFAULT`, `COMPACT`, `DYNAMIC`, o `REDUNDANT`. Per le pagine compresse, imposta `COMPRESSION="none"`.

Per ulteriori informazioni, consulta [InnoDB row formats](https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html) e [InnoDB table and page compression](https://dev.mysql.com/doc/refman/8.0/en/innodb-compression.html) nella documentazione di MySQL.

Puoi utilizzare il seguente script SQL nell'istanza database MySQL esistente per elencare le tabelle nel database che sono tabelle MyISAM o compresse.

```
-- This script examines a MySQL database for conditions that block
-- migrating the database into Aurora MySQL.
-- It must be run from an account that has read permission for the
-- INFORMATION_SCHEMA database.

-- Verify that this is a supported version of MySQL.

select msg as `==> Checking current version of MySQL.`
from
  (
  select
    'This script should be run on MySQL version 5.6 or higher. ' +
    'Earlier versions are not supported.' as msg,
    cast(substring_index(version(), '.', 1) as unsigned) * 100 +
      cast(substring_index(substring_index(version(), '.', 2), '.', -1)
      as unsigned)
    as major_minor
  ) as T
where major_minor <> 506;


-- List MyISAM and compressed tables. Include the table size.

select concat(TABLE_SCHEMA, '.', TABLE_NAME) as `==> MyISAM or Compressed Tables`,
round(((data_length + index_length) / 1024 / 1024), 2) "Approx size (MB)"
from INFORMATION_SCHEMA.TABLES
where
  ENGINE <> 'InnoDB'
  and
  (
    -- User tables
    TABLE_SCHEMA not in ('mysql', 'performance_schema',
                         'information_schema')
    or
    -- Non-standard system tables
    (
      TABLE_SCHEMA = 'mysql' and TABLE_NAME not in
        (
          'columns_priv', 'db', 'event', 'func', 'general_log',
          'help_category', 'help_keyword', 'help_relation',
          'help_topic', 'host', 'ndb_binlog_index', 'plugin',
          'proc', 'procs_priv', 'proxies_priv', 'servers', 'slow_log',
          'tables_priv', 'time_zone', 'time_zone_leap_second',
          'time_zone_name', 'time_zone_transition',
          'time_zone_transition_type', 'user'
        )
    )
  )
  or
  (
    -- Compressed tables
       ROW_FORMAT = 'Compressed'
  );
```

## Account utente con privilegi non supportati
<a name="AuroraMySQL.Migrating.ExtMySQL.Prechecks.Users"></a>

Gli account utente con privilegi non supportati da Aurora MySQL vengono importati senza i privilegi non supportati. Per l'elenco dei privilegi supportati, consulta [Privilegio basato sui ruoli](AuroraMySQL.Compare-80-v3.md#AuroraMySQL.privilege-model).

Puoi eseguire la seguente query SQL sul database di origine per elencare gli account utente con privilegi non supportati.

```
SELECT
    user,
    host
FROM
    mysql.user
WHERE
    Shutdown_priv = 'y'
    OR File_priv = 'y'
    OR Super_priv = 'y'
    OR Create_tablespace_priv = 'y';
```

## Privilegi dinamici in Aurora MySQL versione 3
<a name="AuroraMySQL.Migrating.ExtMySQL.Prechecks.Dynamic"></a>

I privilegi dinamici non vengono importati. Aurora MySQL versione 3 supporta i privilegi dinamici seguenti.

```
'APPLICATION_PASSWORD_ADMIN',
'CONNECTION_ADMIN',
'REPLICATION_APPLIER',
'ROLE_ADMIN',
'SESSION_VARIABLES_ADMIN',
'SET_USER_ID',
'XA_RECOVER_ADMIN'
```

Lo script di esempio seguente concede i privilegi dinamici supportati agli account utente nel cluster database Aurora MySQL.

```
-- This script finds the user accounts that have Aurora MySQL supported dynamic privileges 
-- and grants them to corresponding user accounts in the Aurora MySQL DB cluster.

/home/ec2-user/opt/mysql/8.0.26/bin/mysql -uusername -pxxxxx -P8026 -h127.0.0.1 -BNe "SELECT
  CONCAT('GRANT ', GRANTS, ' ON *.* TO ', GRANTEE ,';') AS grant_statement
  FROM (select GRANTEE, group_concat(privilege_type) AS GRANTS FROM information_schema.user_privileges 
      WHERE privilege_type IN (
        'APPLICATION_PASSWORD_ADMIN',
        'CONNECTION_ADMIN',
        'REPLICATION_APPLIER',
        'ROLE_ADMIN',
        'SESSION_VARIABLES_ADMIN',
        'SET_USER_ID',
        'XA_RECOVER_ADMIN')
      AND GRANTEE NOT IN (\"'mysql.session'@'localhost'\",\"'mysql.infoschema'@'localhost'\",\"'mysql.sys'@'localhost'\") GROUP BY GRANTEE)
      AS PRIVGRANTS; " | /home/ec2-user/opt/mysql/8.0.26/bin/mysql -u master_username -p master_password -h DB_cluster_endpoint
```

## Oggetti archiviati con 'rdsadmin'@'localhost' come definer
<a name="AuroraMySQL.Migrating.ExtMySQL.Prechecks.Objects"></a>

Le funzioni, le procedure, le viste, gli eventi e i trigger con `'rdsadmin'@'localhost'` come definer non vengono importati.

Puoi usare il seguente script SQL nel database MySQL di origine per elencare gli oggetti archiviati con il definire non supportato.

```
-- This SQL query lists routines with `rdsadmin`@`localhost` as the definer.

SELECT
    ROUTINE_SCHEMA,
    ROUTINE_NAME
FROM
    information_schema.routines
WHERE
    definer = 'rdsadmin@localhost';

-- This SQL query lists triggers with `rdsadmin`@`localhost` as the definer.

SELECT
    TRIGGER_SCHEMA,
    TRIGGER_NAME,
    DEFINER
FROM
    information_schema.triggers
WHERE
    DEFINER = 'rdsadmin@localhost';

-- This SQL query lists events with `rdsadmin`@`localhost` as the definer.

SELECT
    EVENT_SCHEMA,
    EVENT_NAME
FROM
    information_schema.events
WHERE
    DEFINER = 'rdsadmin@localhost';

-- This SQL query lists views with `rdsadmin`@`localhost` as the definer.
SELECT
    TABLE_SCHEMA,
    TABLE_NAME
FROM
    information_schema.views
WHERE
    DEFINER = 'rdsadmin@localhost';
```